﻿using System;
using System.Collections;
using System.ComponentModel;
using System.Data;
using System.Linq;
using System.Windows.Forms;
using C1.Win.C1Input;
using C1.Win.C1List;
using C1.Win.C1TrueDBGrid;
using PCSComProduction.WorkOrder.BO;
using PCSComUtils.Common;
using PCSComUtils.Common.BO;
using PCSComUtils.Framework.ReportFrame.BO;
using PCSComUtils.PCSExc;
using PCSUtils.Framework.ReportFrame;
using PCSUtils.Log;
using PCSUtils.Utils;
using AlignHorzEnum = C1.Win.C1TrueDBGrid.AlignHorzEnum;
using BeforeColEditEventArgs = C1.Win.C1TrueDBGrid.BeforeColEditEventArgs;
using BeforeColUpdateEventArgs = C1.Win.C1TrueDBGrid.BeforeColUpdateEventArgs;
using CancelEventArgs = System.ComponentModel.CancelEventArgs;
using ColEventArgs = C1.Win.C1TrueDBGrid.ColEventArgs;
using PresentationEnum = C1.Win.C1TrueDBGrid.PresentationEnum;
using C1.C1Report;
using PCSComUtils.DataContext;

namespace PCSProduction.WorkOrder
{
    /// <summary>
    /// Summary description for MultiWOIssueMaterial.
    /// </summary>
    public class MultiWOIssueMaterial : Form
    {
        #region System Generated Variables

        private TextBox txtIssueNo;
        private Label lblIssueNo;
        private Label lblMasLoc;
        private Label lblPostDate;
        private Label lblCCN;
        private Button btnSelectWO;
        private Button btnClose;
        private Button btnHelp;
        private Button btnSave;
        private Button btnAdd;
        private TextBox txtMasLoc;
        private C1Combo cboCCN;
        private C1TrueDBGrid dgrdData;
        private Button btnFindIssueNo;
        private Button btnFindMasLoc;
        private C1DateEdit dtmPostDate;
        private System.Windows.Forms.TextBox txtPurpose;
        private System.Windows.Forms.TextBox txtToLocation;
        private System.Windows.Forms.Label lblToLocation;
        private System.Windows.Forms.Label lblToBin;
        private System.Windows.Forms.TextBox txtToBin;
        private System.Windows.Forms.Button btnToBin;
        private System.Windows.Forms.Button btnToLocation;
        private System.Windows.Forms.Button btnPurpose;
        private System.Windows.Forms.Button btnShift;
        private System.Windows.Forms.Label lblShift;
        private System.Windows.Forms.TextBox txtShift;
        private System.Windows.Forms.Button btnPrint;
        private System.Windows.Forms.Button btnPrintConfiguration;
        private System.Windows.Forms.Label lblFromBin;
        private System.Windows.Forms.Label lblFromLoc;
        private Container components = null;

        #endregion Generated

        #region Constants

        private const string THIS = "PCSProduction.WorkOrder.MultiWOIssueMaterial";
        private const string REPORTFLD_TITLE = "fldTitle";
        private const string HASBIN = "HasBin";
        private const string WORKORDERNO_COL = PRO_WorkOrderMasterTable.TABLE_NAME + PRO_WorkOrderMasterTable.WORKORDERNO_FLD;
        private const string WORKORDERLINE_COL = PRO_WorkOrderDetailTable.TABLE_NAME + PRO_WorkOrderDetailTable.LINE_FLD;
        private const string LOCATIONCODE_COL = MST_LocationTable.TABLE_NAME + MST_LocationTable.CODE_FLD;
        private const string BINCODE_COL = MST_BINTable.TABLE_NAME + MST_BINTable.CODE_FLD;
        private const string PRODUCTCODE_COL = ITM_ProductTable.TABLE_NAME + ITM_ProductTable.CODE_FLD;
        private const string PRODUCTDESC_COL = ITM_ProductTable.TABLE_NAME + ITM_ProductTable.DESCRIPTION_FLD;
        private const string PRODUCTREVISION_COL = ITM_ProductTable.TABLE_NAME + ITM_ProductTable.REVISION_FLD;
        private const string COMMITQUANTITY_COL = "CommitQuantity";
        private const string NEEDEDQUANTITY_COL = "NeededQuantity";
        private const string LOT_COL = "LOT";
        private const string UNITCODE_COL = MST_UnitOfMeasureTable.TABLE_NAME + MST_UnitOfMeasureTable.CODE_FLD;
        private const string AVAILABLE_QUANTITY = "AvailableQuantity";

        #endregion

        #region Variables

        private PRO_IssueMaterialMaster issueMaterialMaster;
        private EnumAction mFormMode;
        private DataSet dstData = null;
        private DataTable dtStoreGridLayout;
        private decimal pdecTempCommitQuantity;
        private decimal pdecChangedQuantity;
        private System.Windows.Forms.Label lblPurpose;
        private bool blnHasError = false;
        string strLastValidMasLoc = string.Empty;
        string strLastValidLocation = string.Empty;
        string strLastValidBin = string.Empty;
        string strLastValidPurpose = string.Empty;
        private C1.Win.C1Input.C1DateEdit dtmIssueDay;
        private System.Windows.Forms.Label lblIssueDay;
        private System.Windows.Forms.Button btnDelete;
        string strLastValidShift = string.Empty;

        #endregion Variables

        #region Constructor, Destructor
        public MultiWOIssueMaterial()
        {
            InitializeComponent();
        }

        /// <summary>
        /// Clean up any resources being used.
        /// </summary>
        protected override void Dispose(bool disposing)
        {
            if (disposing)
            {
                if (components != null)
                {
                    components.Dispose();
                }
            }
            base.Dispose(disposing);
        }

        #endregion Constructor, Destructor

        #region Windows Form Designer generated code

        /// <summary>
        /// Required method for Designer support - do not modify
        /// the contents of this method with the code editor.
        /// </summary>
        private void InitializeComponent()
        {
            System.Resources.ResourceManager resources = new System.Resources.ResourceManager(typeof(MultiWOIssueMaterial));
            this.btnFindIssueNo = new System.Windows.Forms.Button();
            this.txtIssueNo = new System.Windows.Forms.TextBox();
            this.lblIssueNo = new System.Windows.Forms.Label();
            this.lblMasLoc = new System.Windows.Forms.Label();
            this.lblPostDate = new System.Windows.Forms.Label();
            this.lblCCN = new System.Windows.Forms.Label();
            this.btnSelectWO = new System.Windows.Forms.Button();
            this.btnClose = new System.Windows.Forms.Button();
            this.btnHelp = new System.Windows.Forms.Button();
            this.btnSave = new System.Windows.Forms.Button();
            this.btnAdd = new System.Windows.Forms.Button();
            this.dgrdData = new C1.Win.C1TrueDBGrid.C1TrueDBGrid();
            this.txtMasLoc = new System.Windows.Forms.TextBox();
            this.btnFindMasLoc = new System.Windows.Forms.Button();
            this.cboCCN = new C1.Win.C1List.C1Combo();
            this.dtmPostDate = new C1.Win.C1Input.C1DateEdit();
            this.txtPurpose = new System.Windows.Forms.TextBox();
            this.txtToLocation = new System.Windows.Forms.TextBox();
            this.lblPurpose = new System.Windows.Forms.Label();
            this.lblToLocation = new System.Windows.Forms.Label();
            this.lblToBin = new System.Windows.Forms.Label();
            this.txtToBin = new System.Windows.Forms.TextBox();
            this.btnPurpose = new System.Windows.Forms.Button();
            this.btnToBin = new System.Windows.Forms.Button();
            this.btnToLocation = new System.Windows.Forms.Button();
            this.btnShift = new System.Windows.Forms.Button();
            this.lblShift = new System.Windows.Forms.Label();
            this.txtShift = new System.Windows.Forms.TextBox();
            this.btnPrint = new System.Windows.Forms.Button();
            this.btnPrintConfiguration = new System.Windows.Forms.Button();
            this.lblFromBin = new System.Windows.Forms.Label();
            this.lblFromLoc = new System.Windows.Forms.Label();
            this.dtmIssueDay = new C1.Win.C1Input.C1DateEdit();
            this.lblIssueDay = new System.Windows.Forms.Label();
            this.btnDelete = new System.Windows.Forms.Button();
            ((System.ComponentModel.ISupportInitialize)(this.dgrdData)).BeginInit();
            ((System.ComponentModel.ISupportInitialize)(this.cboCCN)).BeginInit();
            ((System.ComponentModel.ISupportInitialize)(this.dtmPostDate)).BeginInit();
            ((System.ComponentModel.ISupportInitialize)(this.dtmIssueDay)).BeginInit();
            this.SuspendLayout();
            // 
            // btnFindIssueNo
            // 
            this.btnFindIssueNo.AccessibleDescription = resources.GetString("btnFindIssueNo.AccessibleDescription");
            this.btnFindIssueNo.AccessibleName = resources.GetString("btnFindIssueNo.AccessibleName");
            this.btnFindIssueNo.Anchor = ((System.Windows.Forms.AnchorStyles)(resources.GetObject("btnFindIssueNo.Anchor")));
            this.btnFindIssueNo.BackgroundImage = ((System.Drawing.Image)(resources.GetObject("btnFindIssueNo.BackgroundImage")));
            this.btnFindIssueNo.Dock = ((System.Windows.Forms.DockStyle)(resources.GetObject("btnFindIssueNo.Dock")));
            this.btnFindIssueNo.Enabled = ((bool)(resources.GetObject("btnFindIssueNo.Enabled")));
            this.btnFindIssueNo.FlatStyle = ((System.Windows.Forms.FlatStyle)(resources.GetObject("btnFindIssueNo.FlatStyle")));
            this.btnFindIssueNo.Font = ((System.Drawing.Font)(resources.GetObject("btnFindIssueNo.Font")));
            this.btnFindIssueNo.Image = ((System.Drawing.Image)(resources.GetObject("btnFindIssueNo.Image")));
            this.btnFindIssueNo.ImageAlign = ((System.Drawing.ContentAlignment)(resources.GetObject("btnFindIssueNo.ImageAlign")));
            this.btnFindIssueNo.ImageIndex = ((int)(resources.GetObject("btnFindIssueNo.ImageIndex")));
            this.btnFindIssueNo.ImeMode = ((System.Windows.Forms.ImeMode)(resources.GetObject("btnFindIssueNo.ImeMode")));
            this.btnFindIssueNo.Location = ((System.Drawing.Point)(resources.GetObject("btnFindIssueNo.Location")));
            this.btnFindIssueNo.Name = "btnFindIssueNo";
            this.btnFindIssueNo.RightToLeft = ((System.Windows.Forms.RightToLeft)(resources.GetObject("btnFindIssueNo.RightToLeft")));
            this.btnFindIssueNo.Size = ((System.Drawing.Size)(resources.GetObject("btnFindIssueNo.Size")));
            this.btnFindIssueNo.TabIndex = ((int)(resources.GetObject("btnFindIssueNo.TabIndex")));
            this.btnFindIssueNo.Text = resources.GetString("btnFindIssueNo.Text");
            this.btnFindIssueNo.TextAlign = ((System.Drawing.ContentAlignment)(resources.GetObject("btnFindIssueNo.TextAlign")));
            this.btnFindIssueNo.Visible = ((bool)(resources.GetObject("btnFindIssueNo.Visible")));
            this.btnFindIssueNo.Click += new System.EventHandler(this.btnFindIssueNo_Click);
            // 
            // txtIssueNo
            // 
            this.txtIssueNo.AccessibleDescription = resources.GetString("txtIssueNo.AccessibleDescription");
            this.txtIssueNo.AccessibleName = resources.GetString("txtIssueNo.AccessibleName");
            this.txtIssueNo.Anchor = ((System.Windows.Forms.AnchorStyles)(resources.GetObject("txtIssueNo.Anchor")));
            this.txtIssueNo.AutoSize = ((bool)(resources.GetObject("txtIssueNo.AutoSize")));
            this.txtIssueNo.BackgroundImage = ((System.Drawing.Image)(resources.GetObject("txtIssueNo.BackgroundImage")));
            this.txtIssueNo.Dock = ((System.Windows.Forms.DockStyle)(resources.GetObject("txtIssueNo.Dock")));
            this.txtIssueNo.Enabled = ((bool)(resources.GetObject("txtIssueNo.Enabled")));
            this.txtIssueNo.Font = ((System.Drawing.Font)(resources.GetObject("txtIssueNo.Font")));
            this.txtIssueNo.ImeMode = ((System.Windows.Forms.ImeMode)(resources.GetObject("txtIssueNo.ImeMode")));
            this.txtIssueNo.Location = ((System.Drawing.Point)(resources.GetObject("txtIssueNo.Location")));
            this.txtIssueNo.MaxLength = ((int)(resources.GetObject("txtIssueNo.MaxLength")));
            this.txtIssueNo.Multiline = ((bool)(resources.GetObject("txtIssueNo.Multiline")));
            this.txtIssueNo.Name = "txtIssueNo";
            this.txtIssueNo.PasswordChar = ((char)(resources.GetObject("txtIssueNo.PasswordChar")));
            this.txtIssueNo.RightToLeft = ((System.Windows.Forms.RightToLeft)(resources.GetObject("txtIssueNo.RightToLeft")));
            this.txtIssueNo.ScrollBars = ((System.Windows.Forms.ScrollBars)(resources.GetObject("txtIssueNo.ScrollBars")));
            this.txtIssueNo.Size = ((System.Drawing.Size)(resources.GetObject("txtIssueNo.Size")));
            this.txtIssueNo.TabIndex = ((int)(resources.GetObject("txtIssueNo.TabIndex")));
            this.txtIssueNo.Text = resources.GetString("txtIssueNo.Text");
            this.txtIssueNo.TextAlign = ((System.Windows.Forms.HorizontalAlignment)(resources.GetObject("txtIssueNo.TextAlign")));
            this.txtIssueNo.Visible = ((bool)(resources.GetObject("txtIssueNo.Visible")));
            this.txtIssueNo.WordWrap = ((bool)(resources.GetObject("txtIssueNo.WordWrap")));
            this.txtIssueNo.KeyDown += new System.Windows.Forms.KeyEventHandler(this.txtIssueNo_KeyDown);
            this.txtIssueNo.Leave += new System.EventHandler(this.txtIssueNo_Leave);
            this.txtIssueNo.Enter += new System.EventHandler(this.txtIssueNo_Enter);
            // 
            // lblIssueNo
            // 
            this.lblIssueNo.AccessibleDescription = resources.GetString("lblIssueNo.AccessibleDescription");
            this.lblIssueNo.AccessibleName = resources.GetString("lblIssueNo.AccessibleName");
            this.lblIssueNo.Anchor = ((System.Windows.Forms.AnchorStyles)(resources.GetObject("lblIssueNo.Anchor")));
            this.lblIssueNo.AutoSize = ((bool)(resources.GetObject("lblIssueNo.AutoSize")));
            this.lblIssueNo.Dock = ((System.Windows.Forms.DockStyle)(resources.GetObject("lblIssueNo.Dock")));
            this.lblIssueNo.Enabled = ((bool)(resources.GetObject("lblIssueNo.Enabled")));
            this.lblIssueNo.Font = ((System.Drawing.Font)(resources.GetObject("lblIssueNo.Font")));
            this.lblIssueNo.ForeColor = System.Drawing.Color.Maroon;
            this.lblIssueNo.Image = ((System.Drawing.Image)(resources.GetObject("lblIssueNo.Image")));
            this.lblIssueNo.ImageAlign = ((System.Drawing.ContentAlignment)(resources.GetObject("lblIssueNo.ImageAlign")));
            this.lblIssueNo.ImageIndex = ((int)(resources.GetObject("lblIssueNo.ImageIndex")));
            this.lblIssueNo.ImeMode = ((System.Windows.Forms.ImeMode)(resources.GetObject("lblIssueNo.ImeMode")));
            this.lblIssueNo.Location = ((System.Drawing.Point)(resources.GetObject("lblIssueNo.Location")));
            this.lblIssueNo.Name = "lblIssueNo";
            this.lblIssueNo.RightToLeft = ((System.Windows.Forms.RightToLeft)(resources.GetObject("lblIssueNo.RightToLeft")));
            this.lblIssueNo.Size = ((System.Drawing.Size)(resources.GetObject("lblIssueNo.Size")));
            this.lblIssueNo.TabIndex = ((int)(resources.GetObject("lblIssueNo.TabIndex")));
            this.lblIssueNo.Text = resources.GetString("lblIssueNo.Text");
            this.lblIssueNo.TextAlign = ((System.Drawing.ContentAlignment)(resources.GetObject("lblIssueNo.TextAlign")));
            this.lblIssueNo.Visible = ((bool)(resources.GetObject("lblIssueNo.Visible")));
            // 
            // lblMasLoc
            // 
            this.lblMasLoc.AccessibleDescription = resources.GetString("lblMasLoc.AccessibleDescription");
            this.lblMasLoc.AccessibleName = resources.GetString("lblMasLoc.AccessibleName");
            this.lblMasLoc.Anchor = ((System.Windows.Forms.AnchorStyles)(resources.GetObject("lblMasLoc.Anchor")));
            this.lblMasLoc.AutoSize = ((bool)(resources.GetObject("lblMasLoc.AutoSize")));
            this.lblMasLoc.Dock = ((System.Windows.Forms.DockStyle)(resources.GetObject("lblMasLoc.Dock")));
            this.lblMasLoc.Enabled = ((bool)(resources.GetObject("lblMasLoc.Enabled")));
            this.lblMasLoc.Font = ((System.Drawing.Font)(resources.GetObject("lblMasLoc.Font")));
            this.lblMasLoc.ForeColor = System.Drawing.Color.Maroon;
            this.lblMasLoc.Image = ((System.Drawing.Image)(resources.GetObject("lblMasLoc.Image")));
            this.lblMasLoc.ImageAlign = ((System.Drawing.ContentAlignment)(resources.GetObject("lblMasLoc.ImageAlign")));
            this.lblMasLoc.ImageIndex = ((int)(resources.GetObject("lblMasLoc.ImageIndex")));
            this.lblMasLoc.ImeMode = ((System.Windows.Forms.ImeMode)(resources.GetObject("lblMasLoc.ImeMode")));
            this.lblMasLoc.Location = ((System.Drawing.Point)(resources.GetObject("lblMasLoc.Location")));
            this.lblMasLoc.Name = "lblMasLoc";
            this.lblMasLoc.RightToLeft = ((System.Windows.Forms.RightToLeft)(resources.GetObject("lblMasLoc.RightToLeft")));
            this.lblMasLoc.Size = ((System.Drawing.Size)(resources.GetObject("lblMasLoc.Size")));
            this.lblMasLoc.TabIndex = ((int)(resources.GetObject("lblMasLoc.TabIndex")));
            this.lblMasLoc.Text = resources.GetString("lblMasLoc.Text");
            this.lblMasLoc.TextAlign = ((System.Drawing.ContentAlignment)(resources.GetObject("lblMasLoc.TextAlign")));
            this.lblMasLoc.Visible = ((bool)(resources.GetObject("lblMasLoc.Visible")));
            // 
            // lblPostDate
            // 
            this.lblPostDate.AccessibleDescription = resources.GetString("lblPostDate.AccessibleDescription");
            this.lblPostDate.AccessibleName = resources.GetString("lblPostDate.AccessibleName");
            this.lblPostDate.Anchor = ((System.Windows.Forms.AnchorStyles)(resources.GetObject("lblPostDate.Anchor")));
            this.lblPostDate.AutoSize = ((bool)(resources.GetObject("lblPostDate.AutoSize")));
            this.lblPostDate.Dock = ((System.Windows.Forms.DockStyle)(resources.GetObject("lblPostDate.Dock")));
            this.lblPostDate.Enabled = ((bool)(resources.GetObject("lblPostDate.Enabled")));
            this.lblPostDate.Font = ((System.Drawing.Font)(resources.GetObject("lblPostDate.Font")));
            this.lblPostDate.ForeColor = System.Drawing.Color.Maroon;
            this.lblPostDate.Image = ((System.Drawing.Image)(resources.GetObject("lblPostDate.Image")));
            this.lblPostDate.ImageAlign = ((System.Drawing.ContentAlignment)(resources.GetObject("lblPostDate.ImageAlign")));
            this.lblPostDate.ImageIndex = ((int)(resources.GetObject("lblPostDate.ImageIndex")));
            this.lblPostDate.ImeMode = ((System.Windows.Forms.ImeMode)(resources.GetObject("lblPostDate.ImeMode")));
            this.lblPostDate.Location = ((System.Drawing.Point)(resources.GetObject("lblPostDate.Location")));
            this.lblPostDate.Name = "lblPostDate";
            this.lblPostDate.RightToLeft = ((System.Windows.Forms.RightToLeft)(resources.GetObject("lblPostDate.RightToLeft")));
            this.lblPostDate.Size = ((System.Drawing.Size)(resources.GetObject("lblPostDate.Size")));
            this.lblPostDate.TabIndex = ((int)(resources.GetObject("lblPostDate.TabIndex")));
            this.lblPostDate.Text = resources.GetString("lblPostDate.Text");
            this.lblPostDate.TextAlign = ((System.Drawing.ContentAlignment)(resources.GetObject("lblPostDate.TextAlign")));
            this.lblPostDate.Visible = ((bool)(resources.GetObject("lblPostDate.Visible")));
            // 
            // lblCCN
            // 
            this.lblCCN.AccessibleDescription = resources.GetString("lblCCN.AccessibleDescription");
            this.lblCCN.AccessibleName = resources.GetString("lblCCN.AccessibleName");
            this.lblCCN.Anchor = ((System.Windows.Forms.AnchorStyles)(resources.GetObject("lblCCN.Anchor")));
            this.lblCCN.AutoSize = ((bool)(resources.GetObject("lblCCN.AutoSize")));
            this.lblCCN.Dock = ((System.Windows.Forms.DockStyle)(resources.GetObject("lblCCN.Dock")));
            this.lblCCN.Enabled = ((bool)(resources.GetObject("lblCCN.Enabled")));
            this.lblCCN.Font = ((System.Drawing.Font)(resources.GetObject("lblCCN.Font")));
            this.lblCCN.ForeColor = System.Drawing.Color.Maroon;
            this.lblCCN.Image = ((System.Drawing.Image)(resources.GetObject("lblCCN.Image")));
            this.lblCCN.ImageAlign = ((System.Drawing.ContentAlignment)(resources.GetObject("lblCCN.ImageAlign")));
            this.lblCCN.ImageIndex = ((int)(resources.GetObject("lblCCN.ImageIndex")));
            this.lblCCN.ImeMode = ((System.Windows.Forms.ImeMode)(resources.GetObject("lblCCN.ImeMode")));
            this.lblCCN.Location = ((System.Drawing.Point)(resources.GetObject("lblCCN.Location")));
            this.lblCCN.Name = "lblCCN";
            this.lblCCN.RightToLeft = ((System.Windows.Forms.RightToLeft)(resources.GetObject("lblCCN.RightToLeft")));
            this.lblCCN.Size = ((System.Drawing.Size)(resources.GetObject("lblCCN.Size")));
            this.lblCCN.TabIndex = ((int)(resources.GetObject("lblCCN.TabIndex")));
            this.lblCCN.Text = resources.GetString("lblCCN.Text");
            this.lblCCN.TextAlign = ((System.Drawing.ContentAlignment)(resources.GetObject("lblCCN.TextAlign")));
            this.lblCCN.Visible = ((bool)(resources.GetObject("lblCCN.Visible")));
            // 
            // btnSelectWO
            // 
            this.btnSelectWO.AccessibleDescription = resources.GetString("btnSelectWO.AccessibleDescription");
            this.btnSelectWO.AccessibleName = resources.GetString("btnSelectWO.AccessibleName");
            this.btnSelectWO.Anchor = ((System.Windows.Forms.AnchorStyles)(resources.GetObject("btnSelectWO.Anchor")));
            this.btnSelectWO.BackgroundImage = ((System.Drawing.Image)(resources.GetObject("btnSelectWO.BackgroundImage")));
            this.btnSelectWO.Dock = ((System.Windows.Forms.DockStyle)(resources.GetObject("btnSelectWO.Dock")));
            this.btnSelectWO.Enabled = ((bool)(resources.GetObject("btnSelectWO.Enabled")));
            this.btnSelectWO.FlatStyle = ((System.Windows.Forms.FlatStyle)(resources.GetObject("btnSelectWO.FlatStyle")));
            this.btnSelectWO.Font = ((System.Drawing.Font)(resources.GetObject("btnSelectWO.Font")));
            this.btnSelectWO.Image = ((System.Drawing.Image)(resources.GetObject("btnSelectWO.Image")));
            this.btnSelectWO.ImageAlign = ((System.Drawing.ContentAlignment)(resources.GetObject("btnSelectWO.ImageAlign")));
            this.btnSelectWO.ImageIndex = ((int)(resources.GetObject("btnSelectWO.ImageIndex")));
            this.btnSelectWO.ImeMode = ((System.Windows.Forms.ImeMode)(resources.GetObject("btnSelectWO.ImeMode")));
            this.btnSelectWO.Location = ((System.Drawing.Point)(resources.GetObject("btnSelectWO.Location")));
            this.btnSelectWO.Name = "btnSelectWO";
            this.btnSelectWO.RightToLeft = ((System.Windows.Forms.RightToLeft)(resources.GetObject("btnSelectWO.RightToLeft")));
            this.btnSelectWO.Size = ((System.Drawing.Size)(resources.GetObject("btnSelectWO.Size")));
            this.btnSelectWO.TabIndex = ((int)(resources.GetObject("btnSelectWO.TabIndex")));
            this.btnSelectWO.Text = resources.GetString("btnSelectWO.Text");
            this.btnSelectWO.TextAlign = ((System.Drawing.ContentAlignment)(resources.GetObject("btnSelectWO.TextAlign")));
            this.btnSelectWO.Visible = ((bool)(resources.GetObject("btnSelectWO.Visible")));
            this.btnSelectWO.Click += new System.EventHandler(this.btnSelectWO_Click);
            // 
            // btnClose
            // 
            this.btnClose.AccessibleDescription = resources.GetString("btnClose.AccessibleDescription");
            this.btnClose.AccessibleName = resources.GetString("btnClose.AccessibleName");
            this.btnClose.Anchor = ((System.Windows.Forms.AnchorStyles)(resources.GetObject("btnClose.Anchor")));
            this.btnClose.BackgroundImage = ((System.Drawing.Image)(resources.GetObject("btnClose.BackgroundImage")));
            this.btnClose.DialogResult = System.Windows.Forms.DialogResult.Cancel;
            this.btnClose.Dock = ((System.Windows.Forms.DockStyle)(resources.GetObject("btnClose.Dock")));
            this.btnClose.Enabled = ((bool)(resources.GetObject("btnClose.Enabled")));
            this.btnClose.FlatStyle = ((System.Windows.Forms.FlatStyle)(resources.GetObject("btnClose.FlatStyle")));
            this.btnClose.Font = ((System.Drawing.Font)(resources.GetObject("btnClose.Font")));
            this.btnClose.Image = ((System.Drawing.Image)(resources.GetObject("btnClose.Image")));
            this.btnClose.ImageAlign = ((System.Drawing.ContentAlignment)(resources.GetObject("btnClose.ImageAlign")));
            this.btnClose.ImageIndex = ((int)(resources.GetObject("btnClose.ImageIndex")));
            this.btnClose.ImeMode = ((System.Windows.Forms.ImeMode)(resources.GetObject("btnClose.ImeMode")));
            this.btnClose.Location = ((System.Drawing.Point)(resources.GetObject("btnClose.Location")));
            this.btnClose.Name = "btnClose";
            this.btnClose.RightToLeft = ((System.Windows.Forms.RightToLeft)(resources.GetObject("btnClose.RightToLeft")));
            this.btnClose.Size = ((System.Drawing.Size)(resources.GetObject("btnClose.Size")));
            this.btnClose.TabIndex = ((int)(resources.GetObject("btnClose.TabIndex")));
            this.btnClose.Text = resources.GetString("btnClose.Text");
            this.btnClose.TextAlign = ((System.Drawing.ContentAlignment)(resources.GetObject("btnClose.TextAlign")));
            this.btnClose.Visible = ((bool)(resources.GetObject("btnClose.Visible")));
            this.btnClose.Click += new System.EventHandler(this.btnClose_Click);
            // 
            // btnHelp
            // 
            this.btnHelp.AccessibleDescription = resources.GetString("btnHelp.AccessibleDescription");
            this.btnHelp.AccessibleName = resources.GetString("btnHelp.AccessibleName");
            this.btnHelp.Anchor = ((System.Windows.Forms.AnchorStyles)(resources.GetObject("btnHelp.Anchor")));
            this.btnHelp.BackgroundImage = ((System.Drawing.Image)(resources.GetObject("btnHelp.BackgroundImage")));
            this.btnHelp.Dock = ((System.Windows.Forms.DockStyle)(resources.GetObject("btnHelp.Dock")));
            this.btnHelp.Enabled = ((bool)(resources.GetObject("btnHelp.Enabled")));
            this.btnHelp.FlatStyle = ((System.Windows.Forms.FlatStyle)(resources.GetObject("btnHelp.FlatStyle")));
            this.btnHelp.Font = ((System.Drawing.Font)(resources.GetObject("btnHelp.Font")));
            this.btnHelp.Image = ((System.Drawing.Image)(resources.GetObject("btnHelp.Image")));
            this.btnHelp.ImageAlign = ((System.Drawing.ContentAlignment)(resources.GetObject("btnHelp.ImageAlign")));
            this.btnHelp.ImageIndex = ((int)(resources.GetObject("btnHelp.ImageIndex")));
            this.btnHelp.ImeMode = ((System.Windows.Forms.ImeMode)(resources.GetObject("btnHelp.ImeMode")));
            this.btnHelp.Location = ((System.Drawing.Point)(resources.GetObject("btnHelp.Location")));
            this.btnHelp.Name = "btnHelp";
            this.btnHelp.RightToLeft = ((System.Windows.Forms.RightToLeft)(resources.GetObject("btnHelp.RightToLeft")));
            this.btnHelp.Size = ((System.Drawing.Size)(resources.GetObject("btnHelp.Size")));
            this.btnHelp.TabIndex = ((int)(resources.GetObject("btnHelp.TabIndex")));
            this.btnHelp.Text = resources.GetString("btnHelp.Text");
            this.btnHelp.TextAlign = ((System.Drawing.ContentAlignment)(resources.GetObject("btnHelp.TextAlign")));
            this.btnHelp.Visible = ((bool)(resources.GetObject("btnHelp.Visible")));
            this.btnHelp.Click += new System.EventHandler(this.btnHelp_Click);
            // 
            // btnSave
            // 
            this.btnSave.AccessibleDescription = resources.GetString("btnSave.AccessibleDescription");
            this.btnSave.AccessibleName = resources.GetString("btnSave.AccessibleName");
            this.btnSave.Anchor = ((System.Windows.Forms.AnchorStyles)(resources.GetObject("btnSave.Anchor")));
            this.btnSave.BackgroundImage = ((System.Drawing.Image)(resources.GetObject("btnSave.BackgroundImage")));
            this.btnSave.Dock = ((System.Windows.Forms.DockStyle)(resources.GetObject("btnSave.Dock")));
            this.btnSave.Enabled = ((bool)(resources.GetObject("btnSave.Enabled")));
            this.btnSave.FlatStyle = ((System.Windows.Forms.FlatStyle)(resources.GetObject("btnSave.FlatStyle")));
            this.btnSave.Font = ((System.Drawing.Font)(resources.GetObject("btnSave.Font")));
            this.btnSave.Image = ((System.Drawing.Image)(resources.GetObject("btnSave.Image")));
            this.btnSave.ImageAlign = ((System.Drawing.ContentAlignment)(resources.GetObject("btnSave.ImageAlign")));
            this.btnSave.ImageIndex = ((int)(resources.GetObject("btnSave.ImageIndex")));
            this.btnSave.ImeMode = ((System.Windows.Forms.ImeMode)(resources.GetObject("btnSave.ImeMode")));
            this.btnSave.Location = ((System.Drawing.Point)(resources.GetObject("btnSave.Location")));
            this.btnSave.Name = "btnSave";
            this.btnSave.RightToLeft = ((System.Windows.Forms.RightToLeft)(resources.GetObject("btnSave.RightToLeft")));
            this.btnSave.Size = ((System.Drawing.Size)(resources.GetObject("btnSave.Size")));
            this.btnSave.TabIndex = ((int)(resources.GetObject("btnSave.TabIndex")));
            this.btnSave.Text = resources.GetString("btnSave.Text");
            this.btnSave.TextAlign = ((System.Drawing.ContentAlignment)(resources.GetObject("btnSave.TextAlign")));
            this.btnSave.Visible = ((bool)(resources.GetObject("btnSave.Visible")));
            this.btnSave.Click += new System.EventHandler(this.btnSave_Click);
            // 
            // btnAdd
            // 
            this.btnAdd.AccessibleDescription = resources.GetString("btnAdd.AccessibleDescription");
            this.btnAdd.AccessibleName = resources.GetString("btnAdd.AccessibleName");
            this.btnAdd.Anchor = ((System.Windows.Forms.AnchorStyles)(resources.GetObject("btnAdd.Anchor")));
            this.btnAdd.BackgroundImage = ((System.Drawing.Image)(resources.GetObject("btnAdd.BackgroundImage")));
            this.btnAdd.DialogResult = System.Windows.Forms.DialogResult.Cancel;
            this.btnAdd.Dock = ((System.Windows.Forms.DockStyle)(resources.GetObject("btnAdd.Dock")));
            this.btnAdd.Enabled = ((bool)(resources.GetObject("btnAdd.Enabled")));
            this.btnAdd.FlatStyle = ((System.Windows.Forms.FlatStyle)(resources.GetObject("btnAdd.FlatStyle")));
            this.btnAdd.Font = ((System.Drawing.Font)(resources.GetObject("btnAdd.Font")));
            this.btnAdd.Image = ((System.Drawing.Image)(resources.GetObject("btnAdd.Image")));
            this.btnAdd.ImageAlign = ((System.Drawing.ContentAlignment)(resources.GetObject("btnAdd.ImageAlign")));
            this.btnAdd.ImageIndex = ((int)(resources.GetObject("btnAdd.ImageIndex")));
            this.btnAdd.ImeMode = ((System.Windows.Forms.ImeMode)(resources.GetObject("btnAdd.ImeMode")));
            this.btnAdd.Location = ((System.Drawing.Point)(resources.GetObject("btnAdd.Location")));
            this.btnAdd.Name = "btnAdd";
            this.btnAdd.RightToLeft = ((System.Windows.Forms.RightToLeft)(resources.GetObject("btnAdd.RightToLeft")));
            this.btnAdd.Size = ((System.Drawing.Size)(resources.GetObject("btnAdd.Size")));
            this.btnAdd.TabIndex = ((int)(resources.GetObject("btnAdd.TabIndex")));
            this.btnAdd.Text = resources.GetString("btnAdd.Text");
            this.btnAdd.TextAlign = ((System.Drawing.ContentAlignment)(resources.GetObject("btnAdd.TextAlign")));
            this.btnAdd.Visible = ((bool)(resources.GetObject("btnAdd.Visible")));
            this.btnAdd.Click += new System.EventHandler(this.btnAdd_Click);
            // 
            // dgrdData
            // 
            this.dgrdData.AccessibleDescription = resources.GetString("dgrdData.AccessibleDescription");
            this.dgrdData.AccessibleName = resources.GetString("dgrdData.AccessibleName");
            this.dgrdData.AllowAddNew = ((bool)(resources.GetObject("dgrdData.AllowAddNew")));
            this.dgrdData.AllowArrows = ((bool)(resources.GetObject("dgrdData.AllowArrows")));
            this.dgrdData.AllowColMove = ((bool)(resources.GetObject("dgrdData.AllowColMove")));
            this.dgrdData.AllowColSelect = ((bool)(resources.GetObject("dgrdData.AllowColSelect")));
            this.dgrdData.AllowDelete = ((bool)(resources.GetObject("dgrdData.AllowDelete")));
            this.dgrdData.AllowDrag = ((bool)(resources.GetObject("dgrdData.AllowDrag")));
            this.dgrdData.AllowFilter = ((bool)(resources.GetObject("dgrdData.AllowFilter")));
            this.dgrdData.AllowHorizontalSplit = ((bool)(resources.GetObject("dgrdData.AllowHorizontalSplit")));
            this.dgrdData.AllowRowSelect = ((bool)(resources.GetObject("dgrdData.AllowRowSelect")));
            this.dgrdData.AllowSort = ((bool)(resources.GetObject("dgrdData.AllowSort")));
            this.dgrdData.AllowUpdate = ((bool)(resources.GetObject("dgrdData.AllowUpdate")));
            this.dgrdData.AllowUpdateOnBlur = ((bool)(resources.GetObject("dgrdData.AllowUpdateOnBlur")));
            this.dgrdData.AllowVerticalSplit = ((bool)(resources.GetObject("dgrdData.AllowVerticalSplit")));
            this.dgrdData.AlternatingRows = ((bool)(resources.GetObject("dgrdData.AlternatingRows")));
            this.dgrdData.Anchor = ((System.Windows.Forms.AnchorStyles)(resources.GetObject("dgrdData.Anchor")));
            this.dgrdData.BackgroundImage = ((System.Drawing.Image)(resources.GetObject("dgrdData.BackgroundImage")));
            this.dgrdData.BorderStyle = ((System.Windows.Forms.BorderStyle)(resources.GetObject("dgrdData.BorderStyle")));
            this.dgrdData.Caption = resources.GetString("dgrdData.Caption");
            this.dgrdData.CaptionHeight = ((int)(resources.GetObject("dgrdData.CaptionHeight")));
            this.dgrdData.CellTipsDelay = ((int)(resources.GetObject("dgrdData.CellTipsDelay")));
            this.dgrdData.CellTipsWidth = ((int)(resources.GetObject("dgrdData.CellTipsWidth")));
            this.dgrdData.ChildGrid = ((C1.Win.C1TrueDBGrid.C1TrueDBGrid)(resources.GetObject("dgrdData.ChildGrid")));
            this.dgrdData.CollapseColor = ((System.Drawing.Color)(resources.GetObject("dgrdData.CollapseColor")));
            this.dgrdData.ColumnFooters = ((bool)(resources.GetObject("dgrdData.ColumnFooters")));
            this.dgrdData.ColumnHeaders = ((bool)(resources.GetObject("dgrdData.ColumnHeaders")));
            this.dgrdData.DefColWidth = ((int)(resources.GetObject("dgrdData.DefColWidth")));
            this.dgrdData.Dock = ((System.Windows.Forms.DockStyle)(resources.GetObject("dgrdData.Dock")));
            this.dgrdData.EditDropDown = ((bool)(resources.GetObject("dgrdData.EditDropDown")));
            this.dgrdData.EmptyRows = ((bool)(resources.GetObject("dgrdData.EmptyRows")));
            this.dgrdData.Enabled = ((bool)(resources.GetObject("dgrdData.Enabled")));
            this.dgrdData.ExpandColor = ((System.Drawing.Color)(resources.GetObject("dgrdData.ExpandColor")));
            this.dgrdData.ExposeCellMode = ((C1.Win.C1TrueDBGrid.ExposeCellModeEnum)(resources.GetObject("dgrdData.ExposeCellMode")));
            this.dgrdData.ExtendRightColumn = ((bool)(resources.GetObject("dgrdData.ExtendRightColumn")));
            this.dgrdData.FetchRowStyles = ((bool)(resources.GetObject("dgrdData.FetchRowStyles")));
            this.dgrdData.FilterBar = ((bool)(resources.GetObject("dgrdData.FilterBar")));
            this.dgrdData.FlatStyle = ((C1.Win.C1TrueDBGrid.FlatModeEnum)(resources.GetObject("dgrdData.FlatStyle")));
            this.dgrdData.Font = ((System.Drawing.Font)(resources.GetObject("dgrdData.Font")));
            this.dgrdData.GroupByAreaVisible = ((bool)(resources.GetObject("dgrdData.GroupByAreaVisible")));
            this.dgrdData.GroupByCaption = resources.GetString("dgrdData.GroupByCaption");
            this.dgrdData.Images.Add(((System.Drawing.Image)(resources.GetObject("resource"))));
            this.dgrdData.ImeMode = ((System.Windows.Forms.ImeMode)(resources.GetObject("dgrdData.ImeMode")));
            this.dgrdData.LinesPerRow = ((int)(resources.GetObject("dgrdData.LinesPerRow")));
            this.dgrdData.Location = ((System.Drawing.Point)(resources.GetObject("dgrdData.Location")));
            this.dgrdData.MarqueeStyle = C1.Win.C1TrueDBGrid.MarqueeEnum.DottedCellBorder;
            this.dgrdData.Name = "dgrdData";
            this.dgrdData.PictureAddnewRow = ((System.Drawing.Image)(resources.GetObject("dgrdData.PictureAddnewRow")));
            this.dgrdData.PictureCurrentRow = ((System.Drawing.Image)(resources.GetObject("dgrdData.PictureCurrentRow")));
            this.dgrdData.PictureFilterBar = ((System.Drawing.Image)(resources.GetObject("dgrdData.PictureFilterBar")));
            this.dgrdData.PictureFooterRow = ((System.Drawing.Image)(resources.GetObject("dgrdData.PictureFooterRow")));
            this.dgrdData.PictureHeaderRow = ((System.Drawing.Image)(resources.GetObject("dgrdData.PictureHeaderRow")));
            this.dgrdData.PictureModifiedRow = ((System.Drawing.Image)(resources.GetObject("dgrdData.PictureModifiedRow")));
            this.dgrdData.PictureStandardRow = ((System.Drawing.Image)(resources.GetObject("dgrdData.PictureStandardRow")));
            this.dgrdData.PreviewInfo.AllowSizing = ((bool)(resources.GetObject("dgrdData.PreviewInfo.AllowSizing")));
            this.dgrdData.PreviewInfo.Caption = resources.GetString("dgrdData.PreviewInfo.Caption");
            this.dgrdData.PreviewInfo.Location = ((System.Drawing.Point)(resources.GetObject("dgrdData.PreviewInfo.Location")));
            this.dgrdData.PreviewInfo.Size = ((System.Drawing.Size)(resources.GetObject("dgrdData.PreviewInfo.Size")));
            this.dgrdData.PreviewInfo.ToolBars = ((bool)(resources.GetObject("dgrdData.PreviewInfo.ToolBars")));
            this.dgrdData.PreviewInfo.UIStrings.Content = ((string[])(resources.GetObject("dgrdData.PreviewInfo.UIStrings.Content")));
            this.dgrdData.PreviewInfo.ZoomFactor = ((System.Double)(resources.GetObject("dgrdData.PreviewInfo.ZoomFactor")));
            this.dgrdData.PrintInfo.MaxRowHeight = ((int)(resources.GetObject("dgrdData.PrintInfo.MaxRowHeight")));
            this.dgrdData.PrintInfo.OwnerDrawPageFooter = ((bool)(resources.GetObject("dgrdData.PrintInfo.OwnerDrawPageFooter")));
            this.dgrdData.PrintInfo.OwnerDrawPageHeader = ((bool)(resources.GetObject("dgrdData.PrintInfo.OwnerDrawPageHeader")));
            this.dgrdData.PrintInfo.PageFooter = resources.GetString("dgrdData.PrintInfo.PageFooter");
            this.dgrdData.PrintInfo.PageFooterHeight = ((int)(resources.GetObject("dgrdData.PrintInfo.PageFooterHeight")));
            this.dgrdData.PrintInfo.PageHeader = resources.GetString("dgrdData.PrintInfo.PageHeader");
            this.dgrdData.PrintInfo.PageHeaderHeight = ((int)(resources.GetObject("dgrdData.PrintInfo.PageHeaderHeight")));
            this.dgrdData.PrintInfo.PrintHorizontalSplits = ((bool)(resources.GetObject("dgrdData.PrintInfo.PrintHorizontalSplits")));
            this.dgrdData.PrintInfo.ProgressCaption = resources.GetString("dgrdData.PrintInfo.ProgressCaption");
            this.dgrdData.PrintInfo.RepeatColumnFooters = ((bool)(resources.GetObject("dgrdData.PrintInfo.RepeatColumnFooters")));
            this.dgrdData.PrintInfo.RepeatColumnHeaders = ((bool)(resources.GetObject("dgrdData.PrintInfo.RepeatColumnHeaders")));
            this.dgrdData.PrintInfo.RepeatGridHeader = ((bool)(resources.GetObject("dgrdData.PrintInfo.RepeatGridHeader")));
            this.dgrdData.PrintInfo.RepeatSplitHeaders = ((bool)(resources.GetObject("dgrdData.PrintInfo.RepeatSplitHeaders")));
            this.dgrdData.PrintInfo.ShowOptionsDialog = ((bool)(resources.GetObject("dgrdData.PrintInfo.ShowOptionsDialog")));
            this.dgrdData.PrintInfo.ShowProgressForm = ((bool)(resources.GetObject("dgrdData.PrintInfo.ShowProgressForm")));
            this.dgrdData.PrintInfo.ShowSelection = ((bool)(resources.GetObject("dgrdData.PrintInfo.ShowSelection")));
            this.dgrdData.PrintInfo.UseGridColors = ((bool)(resources.GetObject("dgrdData.PrintInfo.UseGridColors")));
            this.dgrdData.RecordSelectors = ((bool)(resources.GetObject("dgrdData.RecordSelectors")));
            this.dgrdData.RecordSelectorWidth = ((int)(resources.GetObject("dgrdData.RecordSelectorWidth")));
            this.dgrdData.RightToLeft = ((System.Windows.Forms.RightToLeft)(resources.GetObject("dgrdData.RightToLeft")));
            this.dgrdData.RowDivider.Color = ((System.Drawing.Color)(resources.GetObject("resource.Color")));
            this.dgrdData.RowDivider.Style = ((C1.Win.C1TrueDBGrid.LineStyleEnum)(resources.GetObject("resource.Style")));
            this.dgrdData.RowHeight = ((int)(resources.GetObject("dgrdData.RowHeight")));
            this.dgrdData.RowSubDividerColor = ((System.Drawing.Color)(resources.GetObject("dgrdData.RowSubDividerColor")));
            this.dgrdData.ScrollTips = ((bool)(resources.GetObject("dgrdData.ScrollTips")));
            this.dgrdData.ScrollTrack = ((bool)(resources.GetObject("dgrdData.ScrollTrack")));
            this.dgrdData.Size = ((System.Drawing.Size)(resources.GetObject("dgrdData.Size")));
            this.dgrdData.SpringMode = ((bool)(resources.GetObject("dgrdData.SpringMode")));
            this.dgrdData.TabAcrossSplits = ((bool)(resources.GetObject("dgrdData.TabAcrossSplits")));
            this.dgrdData.TabIndex = ((int)(resources.GetObject("dgrdData.TabIndex")));
            this.dgrdData.Text = resources.GetString("dgrdData.Text");
            this.dgrdData.ViewCaptionWidth = ((int)(resources.GetObject("dgrdData.ViewCaptionWidth")));
            this.dgrdData.ViewColumnWidth = ((int)(resources.GetObject("dgrdData.ViewColumnWidth")));
            this.dgrdData.Visible = ((bool)(resources.GetObject("dgrdData.Visible")));
            this.dgrdData.WrapCellPointer = ((bool)(resources.GetObject("dgrdData.WrapCellPointer")));
            this.dgrdData.AfterDelete += new System.EventHandler(this.dgrdData_AfterDelete);
            this.dgrdData.BeforeColEdit += new C1.Win.C1TrueDBGrid.BeforeColEditEventHandler(this.dgrdData_BeforeColEdit);
            this.dgrdData.ButtonClick += new C1.Win.C1TrueDBGrid.ColEventHandler(this.dgrdData_ButtonClick);
            this.dgrdData.AfterColUpdate += new C1.Win.C1TrueDBGrid.ColEventHandler(this.dgrdData_AfterColUpdate);
            this.dgrdData.BeforeColUpdate += new C1.Win.C1TrueDBGrid.BeforeColUpdateEventHandler(this.dgrdData_BeforeColUpdate);
            this.dgrdData.KeyDown += new System.Windows.Forms.KeyEventHandler(this.dgrdData_KeyDown);
            this.dgrdData.OnAddNew += new System.EventHandler(this.dgrdData_OnAddNew);
            this.dgrdData.Error += new C1.Win.C1TrueDBGrid.ErrorEventHandler(this.dgrdData_Error);
            this.dgrdData.PropBag = resources.GetString("dgrdData.PropBag");
            // 
            // txtMasLoc
            // 
            this.txtMasLoc.AccessibleDescription = resources.GetString("txtMasLoc.AccessibleDescription");
            this.txtMasLoc.AccessibleName = resources.GetString("txtMasLoc.AccessibleName");
            this.txtMasLoc.Anchor = ((System.Windows.Forms.AnchorStyles)(resources.GetObject("txtMasLoc.Anchor")));
            this.txtMasLoc.AutoSize = ((bool)(resources.GetObject("txtMasLoc.AutoSize")));
            this.txtMasLoc.BackgroundImage = ((System.Drawing.Image)(resources.GetObject("txtMasLoc.BackgroundImage")));
            this.txtMasLoc.Dock = ((System.Windows.Forms.DockStyle)(resources.GetObject("txtMasLoc.Dock")));
            this.txtMasLoc.Enabled = ((bool)(resources.GetObject("txtMasLoc.Enabled")));
            this.txtMasLoc.Font = ((System.Drawing.Font)(resources.GetObject("txtMasLoc.Font")));
            this.txtMasLoc.ImeMode = ((System.Windows.Forms.ImeMode)(resources.GetObject("txtMasLoc.ImeMode")));
            this.txtMasLoc.Location = ((System.Drawing.Point)(resources.GetObject("txtMasLoc.Location")));
            this.txtMasLoc.MaxLength = ((int)(resources.GetObject("txtMasLoc.MaxLength")));
            this.txtMasLoc.Multiline = ((bool)(resources.GetObject("txtMasLoc.Multiline")));
            this.txtMasLoc.Name = "txtMasLoc";
            this.txtMasLoc.PasswordChar = ((char)(resources.GetObject("txtMasLoc.PasswordChar")));
            this.txtMasLoc.RightToLeft = ((System.Windows.Forms.RightToLeft)(resources.GetObject("txtMasLoc.RightToLeft")));
            this.txtMasLoc.ScrollBars = ((System.Windows.Forms.ScrollBars)(resources.GetObject("txtMasLoc.ScrollBars")));
            this.txtMasLoc.Size = ((System.Drawing.Size)(resources.GetObject("txtMasLoc.Size")));
            this.txtMasLoc.TabIndex = ((int)(resources.GetObject("txtMasLoc.TabIndex")));
            this.txtMasLoc.Text = resources.GetString("txtMasLoc.Text");
            this.txtMasLoc.TextAlign = ((System.Windows.Forms.HorizontalAlignment)(resources.GetObject("txtMasLoc.TextAlign")));
            this.txtMasLoc.Visible = ((bool)(resources.GetObject("txtMasLoc.Visible")));
            this.txtMasLoc.WordWrap = ((bool)(resources.GetObject("txtMasLoc.WordWrap")));
            this.txtMasLoc.KeyDown += new System.Windows.Forms.KeyEventHandler(this.txtMasLoc_KeyDown);
            this.txtMasLoc.Validating += new System.ComponentModel.CancelEventHandler(this.txtMasLoc_Validating);
            // 
            // btnFindMasLoc
            // 
            this.btnFindMasLoc.AccessibleDescription = resources.GetString("btnFindMasLoc.AccessibleDescription");
            this.btnFindMasLoc.AccessibleName = resources.GetString("btnFindMasLoc.AccessibleName");
            this.btnFindMasLoc.Anchor = ((System.Windows.Forms.AnchorStyles)(resources.GetObject("btnFindMasLoc.Anchor")));
            this.btnFindMasLoc.BackgroundImage = ((System.Drawing.Image)(resources.GetObject("btnFindMasLoc.BackgroundImage")));
            this.btnFindMasLoc.Dock = ((System.Windows.Forms.DockStyle)(resources.GetObject("btnFindMasLoc.Dock")));
            this.btnFindMasLoc.Enabled = ((bool)(resources.GetObject("btnFindMasLoc.Enabled")));
            this.btnFindMasLoc.FlatStyle = ((System.Windows.Forms.FlatStyle)(resources.GetObject("btnFindMasLoc.FlatStyle")));
            this.btnFindMasLoc.Font = ((System.Drawing.Font)(resources.GetObject("btnFindMasLoc.Font")));
            this.btnFindMasLoc.Image = ((System.Drawing.Image)(resources.GetObject("btnFindMasLoc.Image")));
            this.btnFindMasLoc.ImageAlign = ((System.Drawing.ContentAlignment)(resources.GetObject("btnFindMasLoc.ImageAlign")));
            this.btnFindMasLoc.ImageIndex = ((int)(resources.GetObject("btnFindMasLoc.ImageIndex")));
            this.btnFindMasLoc.ImeMode = ((System.Windows.Forms.ImeMode)(resources.GetObject("btnFindMasLoc.ImeMode")));
            this.btnFindMasLoc.Location = ((System.Drawing.Point)(resources.GetObject("btnFindMasLoc.Location")));
            this.btnFindMasLoc.Name = "btnFindMasLoc";
            this.btnFindMasLoc.RightToLeft = ((System.Windows.Forms.RightToLeft)(resources.GetObject("btnFindMasLoc.RightToLeft")));
            this.btnFindMasLoc.Size = ((System.Drawing.Size)(resources.GetObject("btnFindMasLoc.Size")));
            this.btnFindMasLoc.TabIndex = ((int)(resources.GetObject("btnFindMasLoc.TabIndex")));
            this.btnFindMasLoc.Text = resources.GetString("btnFindMasLoc.Text");
            this.btnFindMasLoc.TextAlign = ((System.Drawing.ContentAlignment)(resources.GetObject("btnFindMasLoc.TextAlign")));
            this.btnFindMasLoc.Visible = ((bool)(resources.GetObject("btnFindMasLoc.Visible")));
            this.btnFindMasLoc.Click += new System.EventHandler(this.btnFindMasLoc_Click);
            // 
            // cboCCN
            // 
            this.cboCCN.AccessibleDescription = resources.GetString("cboCCN.AccessibleDescription");
            this.cboCCN.AccessibleName = resources.GetString("cboCCN.AccessibleName");
            this.cboCCN.AddItemSeparator = ';';
            this.cboCCN.AllowRowSizing = C1.Win.C1List.RowSizingEnum.AllRows;
            this.cboCCN.Anchor = ((System.Windows.Forms.AnchorStyles)(resources.GetObject("cboCCN.Anchor")));
            this.cboCCN.BackgroundImage = ((System.Drawing.Image)(resources.GetObject("cboCCN.BackgroundImage")));
            this.cboCCN.Caption = "";
            this.cboCCN.CaptionHeight = 17;
            this.cboCCN.CharacterCasing = System.Windows.Forms.CharacterCasing.Normal;
            this.cboCCN.ColumnCaptionHeight = 17;
            this.cboCCN.ColumnFooterHeight = 17;
            this.cboCCN.ComboStyle = C1.Win.C1List.ComboStyleEnum.DropdownList;
            this.cboCCN.ContentHeight = 15;
            this.cboCCN.DeadAreaBackColor = System.Drawing.Color.Empty;
            this.cboCCN.Dock = ((System.Windows.Forms.DockStyle)(resources.GetObject("cboCCN.Dock")));
            this.cboCCN.EditorBackColor = System.Drawing.SystemColors.Window;
            this.cboCCN.EditorFont = new System.Drawing.Font("Microsoft Sans Serif", 8.25F, System.Drawing.FontStyle.Regular, System.Drawing.GraphicsUnit.Point, ((System.Byte)(0)));
            this.cboCCN.EditorForeColor = System.Drawing.SystemColors.WindowText;
            this.cboCCN.EditorHeight = 15;
            this.cboCCN.Enabled = ((bool)(resources.GetObject("cboCCN.Enabled")));
            this.cboCCN.FlatStyle = C1.Win.C1List.FlatModeEnum.System;
            this.cboCCN.Font = ((System.Drawing.Font)(resources.GetObject("cboCCN.Font")));
            this.cboCCN.GapHeight = 2;
            this.cboCCN.ImeMode = ((System.Windows.Forms.ImeMode)(resources.GetObject("cboCCN.ImeMode")));
            this.cboCCN.ItemHeight = 15;
            this.cboCCN.Location = ((System.Drawing.Point)(resources.GetObject("cboCCN.Location")));
            this.cboCCN.MatchEntryTimeout = ((long)(2000));
            this.cboCCN.MaxDropDownItems = ((short)(5));
            this.cboCCN.MaxLength = 32767;
            this.cboCCN.MouseCursor = System.Windows.Forms.Cursors.Default;
            this.cboCCN.Name = "cboCCN";
            this.cboCCN.PartialRightColumn = false;
            this.cboCCN.RightToLeft = ((System.Windows.Forms.RightToLeft)(resources.GetObject("cboCCN.RightToLeft")));
            this.cboCCN.RowDivider.Color = System.Drawing.Color.DarkGray;
            this.cboCCN.RowDivider.Style = C1.Win.C1List.LineStyleEnum.None;
            this.cboCCN.RowSubDividerColor = System.Drawing.Color.DarkGray;
            this.cboCCN.Size = ((System.Drawing.Size)(resources.GetObject("cboCCN.Size")));
            this.cboCCN.TabIndex = ((int)(resources.GetObject("cboCCN.TabIndex")));
            this.cboCCN.Text = resources.GetString("cboCCN.Text");
            this.cboCCN.Visible = ((bool)(resources.GetObject("cboCCN.Visible")));
            this.cboCCN.SelectedValueChanged += new System.EventHandler(this.cboCCN_SelectedValueChanged);
            this.cboCCN.PropBag = "<?xml version=\"1.0\"?><Blob><Styles type=\"C1.Win.C1List.Design.ContextWrapper\"><Da" +
                "ta>Group{AlignVert:Center;Border:None,,0, 0, 0, 0;BackColor:ControlDark;}Style2{" +
                "}Style5{}Style4{}Style7{}Style6{}EvenRow{BackColor:Aqua;}Selected{ForeColor:High" +
                "lightText;BackColor:Highlight;}Style3{}Inactive{ForeColor:InactiveCaptionText;Ba" +
                "ckColor:InactiveCaption;}Footer{}Caption{AlignHorz:Center;}Normal{}HighlightRow{" +
                "ForeColor:HighlightText;BackColor:Highlight;}Style1{}OddRow{}RecordSelector{Alig" +
                "nImage:Center;}Heading{Wrap:True;BackColor:Control;Border:Raised,,1, 1, 1, 1;For" +
                "eColor:ControlText;AlignVert:Center;}Style8{}Style10{}Style11{}Style9{AlignHorz:" +
                "Near;}</Data></Styles><Splits><C1.Win.C1List.ListBoxView AllowColSelect=\"False\" " +
                "Name=\"\" CaptionHeight=\"17\" ColumnCaptionHeight=\"17\" ColumnFooterHeight=\"17\" Vert" +
                "icalScrollGroup=\"1\" HorizontalScrollGroup=\"1\"><ClientRect>0, 0, 118, 158</Client" +
                "Rect><VScrollBar><Width>17</Width></VScrollBar><HScrollBar><Height>17</Height></" +
                "HScrollBar><CaptionStyle parent=\"Style2\" me=\"Style9\" /><EvenRowStyle parent=\"Eve" +
                "nRow\" me=\"Style7\" /><FooterStyle parent=\"Footer\" me=\"Style3\" /><GroupStyle paren" +
                "t=\"Group\" me=\"Style11\" /><HeadingStyle parent=\"Heading\" me=\"Style2\" /><HighLight" +
                "RowStyle parent=\"HighlightRow\" me=\"Style6\" /><InactiveStyle parent=\"Inactive\" me" +
                "=\"Style4\" /><OddRowStyle parent=\"OddRow\" me=\"Style8\" /><RecordSelectorStyle pare" +
                "nt=\"RecordSelector\" me=\"Style10\" /><SelectedStyle parent=\"Selected\" me=\"Style5\" " +
                "/><Style parent=\"Normal\" me=\"Style1\" /></C1.Win.C1List.ListBoxView></Splits><Nam" +
                "edStyles><Style parent=\"\" me=\"Normal\" /><Style parent=\"Normal\" me=\"Heading\" /><S" +
                "tyle parent=\"Heading\" me=\"Footer\" /><Style parent=\"Heading\" me=\"Caption\" /><Styl" +
                "e parent=\"Heading\" me=\"Inactive\" /><Style parent=\"Normal\" me=\"Selected\" /><Style" +
                " parent=\"Normal\" me=\"HighlightRow\" /><Style parent=\"Normal\" me=\"EvenRow\" /><Styl" +
                "e parent=\"Normal\" me=\"OddRow\" /><Style parent=\"Heading\" me=\"RecordSelector\" /><S" +
                "tyle parent=\"Caption\" me=\"Group\" /></NamedStyles><vertSplits>1</vertSplits><horz" +
                "Splits>1</horzSplits><Layout>Modified</Layout><DefaultRecSelWidth>17</DefaultRec" +
                "SelWidth></Blob>";
            // 
            // dtmPostDate
            // 
            this.dtmPostDate.AcceptsEscape = ((bool)(resources.GetObject("dtmPostDate.AcceptsEscape")));
            this.dtmPostDate.AccessibleDescription = resources.GetString("dtmPostDate.AccessibleDescription");
            this.dtmPostDate.AccessibleName = resources.GetString("dtmPostDate.AccessibleName");
            this.dtmPostDate.Anchor = ((System.Windows.Forms.AnchorStyles)(resources.GetObject("dtmPostDate.Anchor")));
            this.dtmPostDate.AutoSize = ((bool)(resources.GetObject("dtmPostDate.AutoSize")));
            this.dtmPostDate.BackgroundImage = ((System.Drawing.Image)(resources.GetObject("dtmPostDate.BackgroundImage")));
            this.dtmPostDate.BorderStyle = ((System.Windows.Forms.BorderStyle)(resources.GetObject("dtmPostDate.BorderStyle")));
            // 
            // dtmPostDate.Calendar
            // 
            this.dtmPostDate.Calendar.AccessibleDescription = resources.GetString("dtmPostDate.Calendar.AccessibleDescription");
            this.dtmPostDate.Calendar.AccessibleName = resources.GetString("dtmPostDate.Calendar.AccessibleName");
            this.dtmPostDate.Calendar.AnnuallyBoldedDates = ((System.DateTime[])(resources.GetObject("dtmPostDate.Calendar.AnnuallyBoldedDates")));
            this.dtmPostDate.Calendar.BackgroundImage = ((System.Drawing.Image)(resources.GetObject("dtmPostDate.Calendar.BackgroundImage")));
            this.dtmPostDate.Calendar.BoldedDates = ((System.DateTime[])(resources.GetObject("dtmPostDate.Calendar.BoldedDates")));
            this.dtmPostDate.Calendar.CalendarDimensions = ((System.Drawing.Size)(resources.GetObject("dtmPostDate.Calendar.CalendarDimensions")));
            this.dtmPostDate.Calendar.Enabled = ((bool)(resources.GetObject("dtmPostDate.Calendar.Enabled")));
            this.dtmPostDate.Calendar.FirstDayOfWeek = ((System.Windows.Forms.Day)(resources.GetObject("dtmPostDate.Calendar.FirstDayOfWeek")));
            this.dtmPostDate.Calendar.Font = ((System.Drawing.Font)(resources.GetObject("dtmPostDate.Calendar.Font")));
            this.dtmPostDate.Calendar.ImeMode = ((System.Windows.Forms.ImeMode)(resources.GetObject("dtmPostDate.Calendar.ImeMode")));
            this.dtmPostDate.Calendar.MonthlyBoldedDates = ((System.DateTime[])(resources.GetObject("dtmPostDate.Calendar.MonthlyBoldedDates")));
            this.dtmPostDate.Calendar.RightToLeft = ((System.Windows.Forms.RightToLeft)(resources.GetObject("dtmPostDate.Calendar.RightToLeft")));
            this.dtmPostDate.Calendar.ShowClearButton = ((bool)(resources.GetObject("dtmPostDate.Calendar.ShowClearButton")));
            this.dtmPostDate.Calendar.ShowTodayButton = ((bool)(resources.GetObject("dtmPostDate.Calendar.ShowTodayButton")));
            this.dtmPostDate.Calendar.ShowWeekNumbers = ((bool)(resources.GetObject("dtmPostDate.Calendar.ShowWeekNumbers")));
            this.dtmPostDate.CaseSensitive = ((bool)(resources.GetObject("dtmPostDate.CaseSensitive")));
            this.dtmPostDate.Culture = ((int)(resources.GetObject("dtmPostDate.Culture")));
            this.dtmPostDate.CurrentTimeZone = ((bool)(resources.GetObject("dtmPostDate.CurrentTimeZone")));
            this.dtmPostDate.CustomFormat = resources.GetString("dtmPostDate.CustomFormat");
            this.dtmPostDate.DaylightTimeAdjustment = ((C1.Win.C1Input.DaylightTimeAdjustmentEnum)(resources.GetObject("dtmPostDate.DaylightTimeAdjustment")));
            this.dtmPostDate.DisplayFormat.CustomFormat = resources.GetString("dtmPostDate.DisplayFormat.CustomFormat");
            this.dtmPostDate.DisplayFormat.FormatType = ((C1.Win.C1Input.FormatTypeEnum)(resources.GetObject("dtmPostDate.DisplayFormat.FormatType")));
            this.dtmPostDate.DisplayFormat.Inherit = ((C1.Win.C1Input.FormatInfoInheritFlags)(resources.GetObject("dtmPostDate.DisplayFormat.Inherit")));
            this.dtmPostDate.DisplayFormat.NullText = resources.GetString("dtmPostDate.DisplayFormat.NullText");
            this.dtmPostDate.DisplayFormat.TrimEnd = ((bool)(resources.GetObject("dtmPostDate.DisplayFormat.TrimEnd")));
            this.dtmPostDate.DisplayFormat.TrimStart = ((bool)(resources.GetObject("dtmPostDate.DisplayFormat.TrimStart")));
            this.dtmPostDate.Dock = ((System.Windows.Forms.DockStyle)(resources.GetObject("dtmPostDate.Dock")));
            this.dtmPostDate.DropDownFormAlign = ((C1.Win.C1Input.DropDownFormAlignmentEnum)(resources.GetObject("dtmPostDate.DropDownFormAlign")));
            this.dtmPostDate.EditFormat.CustomFormat = resources.GetString("dtmPostDate.EditFormat.CustomFormat");
            this.dtmPostDate.EditFormat.FormatType = ((C1.Win.C1Input.FormatTypeEnum)(resources.GetObject("dtmPostDate.EditFormat.FormatType")));
            this.dtmPostDate.EditFormat.Inherit = ((C1.Win.C1Input.FormatInfoInheritFlags)(resources.GetObject("dtmPostDate.EditFormat.Inherit")));
            this.dtmPostDate.EditFormat.NullText = resources.GetString("dtmPostDate.EditFormat.NullText");
            this.dtmPostDate.EditFormat.TrimEnd = ((bool)(resources.GetObject("dtmPostDate.EditFormat.TrimEnd")));
            this.dtmPostDate.EditFormat.TrimStart = ((bool)(resources.GetObject("dtmPostDate.EditFormat.TrimStart")));
            this.dtmPostDate.EditMask = resources.GetString("dtmPostDate.EditMask");
            this.dtmPostDate.EmptyAsNull = ((bool)(resources.GetObject("dtmPostDate.EmptyAsNull")));
            this.dtmPostDate.Enabled = ((bool)(resources.GetObject("dtmPostDate.Enabled")));
            this.dtmPostDate.ErrorInfo.BeepOnError = ((bool)(resources.GetObject("dtmPostDate.ErrorInfo.BeepOnError")));
            this.dtmPostDate.ErrorInfo.ErrorMessage = resources.GetString("dtmPostDate.ErrorInfo.ErrorMessage");
            this.dtmPostDate.ErrorInfo.ErrorMessageCaption = resources.GetString("dtmPostDate.ErrorInfo.ErrorMessageCaption");
            this.dtmPostDate.ErrorInfo.ShowErrorMessage = ((bool)(resources.GetObject("dtmPostDate.ErrorInfo.ShowErrorMessage")));
            this.dtmPostDate.ErrorInfo.ValueOnError = ((object)(resources.GetObject("dtmPostDate.ErrorInfo.ValueOnError")));
            this.dtmPostDate.Font = ((System.Drawing.Font)(resources.GetObject("dtmPostDate.Font")));
            this.dtmPostDate.FormatType = ((C1.Win.C1Input.FormatTypeEnum)(resources.GetObject("dtmPostDate.FormatType")));
            this.dtmPostDate.GapHeight = ((int)(resources.GetObject("dtmPostDate.GapHeight")));
            this.dtmPostDate.GMTOffset = ((System.TimeSpan)(resources.GetObject("dtmPostDate.GMTOffset")));
            this.dtmPostDate.ImeMode = ((System.Windows.Forms.ImeMode)(resources.GetObject("dtmPostDate.ImeMode")));
            this.dtmPostDate.InitialSelection = ((C1.Win.C1Input.InitialSelectionEnum)(resources.GetObject("dtmPostDate.InitialSelection")));
            this.dtmPostDate.Location = ((System.Drawing.Point)(resources.GetObject("dtmPostDate.Location")));
            this.dtmPostDate.MaskInfo.AutoTabWhenFilled = ((bool)(resources.GetObject("dtmPostDate.MaskInfo.AutoTabWhenFilled")));
            this.dtmPostDate.MaskInfo.CaseSensitive = ((bool)(resources.GetObject("dtmPostDate.MaskInfo.CaseSensitive")));
            this.dtmPostDate.MaskInfo.CopyWithLiterals = ((bool)(resources.GetObject("dtmPostDate.MaskInfo.CopyWithLiterals")));
            this.dtmPostDate.MaskInfo.EditMask = resources.GetString("dtmPostDate.MaskInfo.EditMask");
            this.dtmPostDate.MaskInfo.EmptyAsNull = ((bool)(resources.GetObject("dtmPostDate.MaskInfo.EmptyAsNull")));
            this.dtmPostDate.MaskInfo.ErrorMessage = resources.GetString("dtmPostDate.MaskInfo.ErrorMessage");
            this.dtmPostDate.MaskInfo.Inherit = ((C1.Win.C1Input.MaskInfoInheritFlags)(resources.GetObject("dtmPostDate.MaskInfo.Inherit")));
            this.dtmPostDate.MaskInfo.PromptChar = ((char)(resources.GetObject("dtmPostDate.MaskInfo.PromptChar")));
            this.dtmPostDate.MaskInfo.ShowLiterals = ((C1.Win.C1Input.ShowLiteralsEnum)(resources.GetObject("dtmPostDate.MaskInfo.ShowLiterals")));
            this.dtmPostDate.MaskInfo.StoredEmptyChar = ((char)(resources.GetObject("dtmPostDate.MaskInfo.StoredEmptyChar")));
            this.dtmPostDate.MaxLength = ((int)(resources.GetObject("dtmPostDate.MaxLength")));
            this.dtmPostDate.Name = "dtmPostDate";
            this.dtmPostDate.NullText = resources.GetString("dtmPostDate.NullText");
            this.dtmPostDate.ParseInfo.CaseSensitive = ((bool)(resources.GetObject("dtmPostDate.ParseInfo.CaseSensitive")));
            this.dtmPostDate.ParseInfo.CustomFormat = resources.GetString("dtmPostDate.ParseInfo.CustomFormat");
            this.dtmPostDate.ParseInfo.DateTimeStyle = ((C1.Win.C1Input.DateTimeStyleFlags)(resources.GetObject("dtmPostDate.ParseInfo.DateTimeStyle")));
            this.dtmPostDate.ParseInfo.EmptyAsNull = ((bool)(resources.GetObject("dtmPostDate.ParseInfo.EmptyAsNull")));
            this.dtmPostDate.ParseInfo.ErrorMessage = resources.GetString("dtmPostDate.ParseInfo.ErrorMessage");
            this.dtmPostDate.ParseInfo.FormatType = ((C1.Win.C1Input.FormatTypeEnum)(resources.GetObject("dtmPostDate.ParseInfo.FormatType")));
            this.dtmPostDate.ParseInfo.Inherit = ((C1.Win.C1Input.ParseInfoInheritFlags)(resources.GetObject("dtmPostDate.ParseInfo.Inherit")));
            this.dtmPostDate.ParseInfo.NullText = resources.GetString("dtmPostDate.ParseInfo.NullText");
            this.dtmPostDate.ParseInfo.TrimEnd = ((bool)(resources.GetObject("dtmPostDate.ParseInfo.TrimEnd")));
            this.dtmPostDate.ParseInfo.TrimStart = ((bool)(resources.GetObject("dtmPostDate.ParseInfo.TrimStart")));
            this.dtmPostDate.PasswordChar = ((char)(resources.GetObject("dtmPostDate.PasswordChar")));
            this.dtmPostDate.PostValidation.CaseSensitive = ((bool)(resources.GetObject("dtmPostDate.PostValidation.CaseSensitive")));
            this.dtmPostDate.PostValidation.ErrorMessage = resources.GetString("dtmPostDate.PostValidation.ErrorMessage");
            this.dtmPostDate.PostValidation.Inherit = ((C1.Win.C1Input.PostValidationInheritFlags)(resources.GetObject("dtmPostDate.PostValidation.Inherit")));
            this.dtmPostDate.PostValidation.Intervals.AddRange(new C1.Win.C1Input.ValueInterval[] {
																									  ((C1.Win.C1Input.ValueInterval)(resources.GetObject("dtmPostDate.PostValidation.Intervals")))});
            this.dtmPostDate.PostValidation.Validation = ((C1.Win.C1Input.PostValidationTypeEnum)(resources.GetObject("dtmPostDate.PostValidation.Validation")));
            this.dtmPostDate.PostValidation.Values = ((System.Array)(resources.GetObject("dtmPostDate.PostValidation.Values")));
            this.dtmPostDate.PostValidation.ValuesExcluded = ((System.Array)(resources.GetObject("dtmPostDate.PostValidation.ValuesExcluded")));
            this.dtmPostDate.PreValidation.CaseSensitive = ((bool)(resources.GetObject("dtmPostDate.PreValidation.CaseSensitive")));
            this.dtmPostDate.PreValidation.ErrorMessage = resources.GetString("dtmPostDate.PreValidation.ErrorMessage");
            this.dtmPostDate.PreValidation.Inherit = ((C1.Win.C1Input.PreValidationInheritFlags)(resources.GetObject("dtmPostDate.PreValidation.Inherit")));
            this.dtmPostDate.PreValidation.ItemSeparator = resources.GetString("dtmPostDate.PreValidation.ItemSeparator");
            this.dtmPostDate.PreValidation.PatternString = resources.GetString("dtmPostDate.PreValidation.PatternString");
            this.dtmPostDate.PreValidation.RegexOptions = ((C1.Win.C1Input.RegexOptionFlags)(resources.GetObject("dtmPostDate.PreValidation.RegexOptions")));
            this.dtmPostDate.PreValidation.TrimEnd = ((bool)(resources.GetObject("dtmPostDate.PreValidation.TrimEnd")));
            this.dtmPostDate.PreValidation.TrimStart = ((bool)(resources.GetObject("dtmPostDate.PreValidation.TrimStart")));
            this.dtmPostDate.PreValidation.Validation = ((C1.Win.C1Input.PreValidationTypeEnum)(resources.GetObject("dtmPostDate.PreValidation.Validation")));
            this.dtmPostDate.RightToLeft = ((System.Windows.Forms.RightToLeft)(resources.GetObject("dtmPostDate.RightToLeft")));
            this.dtmPostDate.ShowFocusRectangle = ((bool)(resources.GetObject("dtmPostDate.ShowFocusRectangle")));
            this.dtmPostDate.Size = ((System.Drawing.Size)(resources.GetObject("dtmPostDate.Size")));
            this.dtmPostDate.TabIndex = ((int)(resources.GetObject("dtmPostDate.TabIndex")));
            this.dtmPostDate.Tag = ((object)(resources.GetObject("dtmPostDate.Tag")));
            this.dtmPostDate.TextAlign = ((System.Windows.Forms.HorizontalAlignment)(resources.GetObject("dtmPostDate.TextAlign")));
            this.dtmPostDate.TrimEnd = ((bool)(resources.GetObject("dtmPostDate.TrimEnd")));
            this.dtmPostDate.TrimStart = ((bool)(resources.GetObject("dtmPostDate.TrimStart")));
            this.dtmPostDate.UserCultureOverride = ((bool)(resources.GetObject("dtmPostDate.UserCultureOverride")));
            this.dtmPostDate.Value = ((object)(resources.GetObject("dtmPostDate.Value")));
            this.dtmPostDate.VerticalAlign = ((C1.Win.C1Input.VerticalAlignEnum)(resources.GetObject("dtmPostDate.VerticalAlign")));
            this.dtmPostDate.Visible = ((bool)(resources.GetObject("dtmPostDate.Visible")));
            this.dtmPostDate.VisibleButtons = ((C1.Win.C1Input.DropDownControlButtonFlags)(resources.GetObject("dtmPostDate.VisibleButtons")));
            this.dtmPostDate.Validating += new System.ComponentModel.CancelEventHandler(this.dtmPostDate_Validating);
            // 
            // txtPurpose
            // 
            this.txtPurpose.AccessibleDescription = resources.GetString("txtPurpose.AccessibleDescription");
            this.txtPurpose.AccessibleName = resources.GetString("txtPurpose.AccessibleName");
            this.txtPurpose.Anchor = ((System.Windows.Forms.AnchorStyles)(resources.GetObject("txtPurpose.Anchor")));
            this.txtPurpose.AutoSize = ((bool)(resources.GetObject("txtPurpose.AutoSize")));
            this.txtPurpose.BackgroundImage = ((System.Drawing.Image)(resources.GetObject("txtPurpose.BackgroundImage")));
            this.txtPurpose.Dock = ((System.Windows.Forms.DockStyle)(resources.GetObject("txtPurpose.Dock")));
            this.txtPurpose.Enabled = ((bool)(resources.GetObject("txtPurpose.Enabled")));
            this.txtPurpose.Font = ((System.Drawing.Font)(resources.GetObject("txtPurpose.Font")));
            this.txtPurpose.ImeMode = ((System.Windows.Forms.ImeMode)(resources.GetObject("txtPurpose.ImeMode")));
            this.txtPurpose.Location = ((System.Drawing.Point)(resources.GetObject("txtPurpose.Location")));
            this.txtPurpose.MaxLength = ((int)(resources.GetObject("txtPurpose.MaxLength")));
            this.txtPurpose.Multiline = ((bool)(resources.GetObject("txtPurpose.Multiline")));
            this.txtPurpose.Name = "txtPurpose";
            this.txtPurpose.PasswordChar = ((char)(resources.GetObject("txtPurpose.PasswordChar")));
            this.txtPurpose.RightToLeft = ((System.Windows.Forms.RightToLeft)(resources.GetObject("txtPurpose.RightToLeft")));
            this.txtPurpose.ScrollBars = ((System.Windows.Forms.ScrollBars)(resources.GetObject("txtPurpose.ScrollBars")));
            this.txtPurpose.Size = ((System.Drawing.Size)(resources.GetObject("txtPurpose.Size")));
            this.txtPurpose.TabIndex = ((int)(resources.GetObject("txtPurpose.TabIndex")));
            this.txtPurpose.Text = resources.GetString("txtPurpose.Text");
            this.txtPurpose.TextAlign = ((System.Windows.Forms.HorizontalAlignment)(resources.GetObject("txtPurpose.TextAlign")));
            this.txtPurpose.Visible = ((bool)(resources.GetObject("txtPurpose.Visible")));
            this.txtPurpose.WordWrap = ((bool)(resources.GetObject("txtPurpose.WordWrap")));
            this.txtPurpose.KeyDown += new System.Windows.Forms.KeyEventHandler(this.txtPurpose_KeyDown);
            this.txtPurpose.Validating += new System.ComponentModel.CancelEventHandler(this.txtPurpose_Validating);
            // 
            // txtToLocation
            // 
            this.txtToLocation.AccessibleDescription = resources.GetString("txtToLocation.AccessibleDescription");
            this.txtToLocation.AccessibleName = resources.GetString("txtToLocation.AccessibleName");
            this.txtToLocation.Anchor = ((System.Windows.Forms.AnchorStyles)(resources.GetObject("txtToLocation.Anchor")));
            this.txtToLocation.AutoSize = ((bool)(resources.GetObject("txtToLocation.AutoSize")));
            this.txtToLocation.BackgroundImage = ((System.Drawing.Image)(resources.GetObject("txtToLocation.BackgroundImage")));
            this.txtToLocation.Dock = ((System.Windows.Forms.DockStyle)(resources.GetObject("txtToLocation.Dock")));
            this.txtToLocation.Enabled = ((bool)(resources.GetObject("txtToLocation.Enabled")));
            this.txtToLocation.Font = ((System.Drawing.Font)(resources.GetObject("txtToLocation.Font")));
            this.txtToLocation.ImeMode = ((System.Windows.Forms.ImeMode)(resources.GetObject("txtToLocation.ImeMode")));
            this.txtToLocation.Location = ((System.Drawing.Point)(resources.GetObject("txtToLocation.Location")));
            this.txtToLocation.MaxLength = ((int)(resources.GetObject("txtToLocation.MaxLength")));
            this.txtToLocation.Multiline = ((bool)(resources.GetObject("txtToLocation.Multiline")));
            this.txtToLocation.Name = "txtToLocation";
            this.txtToLocation.PasswordChar = ((char)(resources.GetObject("txtToLocation.PasswordChar")));
            this.txtToLocation.RightToLeft = ((System.Windows.Forms.RightToLeft)(resources.GetObject("txtToLocation.RightToLeft")));
            this.txtToLocation.ScrollBars = ((System.Windows.Forms.ScrollBars)(resources.GetObject("txtToLocation.ScrollBars")));
            this.txtToLocation.Size = ((System.Drawing.Size)(resources.GetObject("txtToLocation.Size")));
            this.txtToLocation.TabIndex = ((int)(resources.GetObject("txtToLocation.TabIndex")));
            this.txtToLocation.Text = resources.GetString("txtToLocation.Text");
            this.txtToLocation.TextAlign = ((System.Windows.Forms.HorizontalAlignment)(resources.GetObject("txtToLocation.TextAlign")));
            this.txtToLocation.Visible = ((bool)(resources.GetObject("txtToLocation.Visible")));
            this.txtToLocation.WordWrap = ((bool)(resources.GetObject("txtToLocation.WordWrap")));
            this.txtToLocation.KeyDown += new System.Windows.Forms.KeyEventHandler(this.txtToLocation_KeyDown);
            this.txtToLocation.Validating += new System.ComponentModel.CancelEventHandler(this.txtToLocation_Validating);
            // 
            // lblPurpose
            // 
            this.lblPurpose.AccessibleDescription = resources.GetString("lblPurpose.AccessibleDescription");
            this.lblPurpose.AccessibleName = resources.GetString("lblPurpose.AccessibleName");
            this.lblPurpose.Anchor = ((System.Windows.Forms.AnchorStyles)(resources.GetObject("lblPurpose.Anchor")));
            this.lblPurpose.AutoSize = ((bool)(resources.GetObject("lblPurpose.AutoSize")));
            this.lblPurpose.Dock = ((System.Windows.Forms.DockStyle)(resources.GetObject("lblPurpose.Dock")));
            this.lblPurpose.Enabled = ((bool)(resources.GetObject("lblPurpose.Enabled")));
            this.lblPurpose.Font = ((System.Drawing.Font)(resources.GetObject("lblPurpose.Font")));
            this.lblPurpose.ForeColor = System.Drawing.Color.Maroon;
            this.lblPurpose.Image = ((System.Drawing.Image)(resources.GetObject("lblPurpose.Image")));
            this.lblPurpose.ImageAlign = ((System.Drawing.ContentAlignment)(resources.GetObject("lblPurpose.ImageAlign")));
            this.lblPurpose.ImageIndex = ((int)(resources.GetObject("lblPurpose.ImageIndex")));
            this.lblPurpose.ImeMode = ((System.Windows.Forms.ImeMode)(resources.GetObject("lblPurpose.ImeMode")));
            this.lblPurpose.Location = ((System.Drawing.Point)(resources.GetObject("lblPurpose.Location")));
            this.lblPurpose.Name = "lblPurpose";
            this.lblPurpose.RightToLeft = ((System.Windows.Forms.RightToLeft)(resources.GetObject("lblPurpose.RightToLeft")));
            this.lblPurpose.Size = ((System.Drawing.Size)(resources.GetObject("lblPurpose.Size")));
            this.lblPurpose.TabIndex = ((int)(resources.GetObject("lblPurpose.TabIndex")));
            this.lblPurpose.Text = resources.GetString("lblPurpose.Text");
            this.lblPurpose.TextAlign = ((System.Drawing.ContentAlignment)(resources.GetObject("lblPurpose.TextAlign")));
            this.lblPurpose.Visible = ((bool)(resources.GetObject("lblPurpose.Visible")));
            // 
            // lblToLocation
            // 
            this.lblToLocation.AccessibleDescription = resources.GetString("lblToLocation.AccessibleDescription");
            this.lblToLocation.AccessibleName = resources.GetString("lblToLocation.AccessibleName");
            this.lblToLocation.Anchor = ((System.Windows.Forms.AnchorStyles)(resources.GetObject("lblToLocation.Anchor")));
            this.lblToLocation.AutoSize = ((bool)(resources.GetObject("lblToLocation.AutoSize")));
            this.lblToLocation.Dock = ((System.Windows.Forms.DockStyle)(resources.GetObject("lblToLocation.Dock")));
            this.lblToLocation.Enabled = ((bool)(resources.GetObject("lblToLocation.Enabled")));
            this.lblToLocation.Font = ((System.Drawing.Font)(resources.GetObject("lblToLocation.Font")));
            this.lblToLocation.ForeColor = System.Drawing.Color.Maroon;
            this.lblToLocation.Image = ((System.Drawing.Image)(resources.GetObject("lblToLocation.Image")));
            this.lblToLocation.ImageAlign = ((System.Drawing.ContentAlignment)(resources.GetObject("lblToLocation.ImageAlign")));
            this.lblToLocation.ImageIndex = ((int)(resources.GetObject("lblToLocation.ImageIndex")));
            this.lblToLocation.ImeMode = ((System.Windows.Forms.ImeMode)(resources.GetObject("lblToLocation.ImeMode")));
            this.lblToLocation.Location = ((System.Drawing.Point)(resources.GetObject("lblToLocation.Location")));
            this.lblToLocation.Name = "lblToLocation";
            this.lblToLocation.RightToLeft = ((System.Windows.Forms.RightToLeft)(resources.GetObject("lblToLocation.RightToLeft")));
            this.lblToLocation.Size = ((System.Drawing.Size)(resources.GetObject("lblToLocation.Size")));
            this.lblToLocation.TabIndex = ((int)(resources.GetObject("lblToLocation.TabIndex")));
            this.lblToLocation.Text = resources.GetString("lblToLocation.Text");
            this.lblToLocation.TextAlign = ((System.Drawing.ContentAlignment)(resources.GetObject("lblToLocation.TextAlign")));
            this.lblToLocation.Visible = ((bool)(resources.GetObject("lblToLocation.Visible")));
            // 
            // lblToBin
            // 
            this.lblToBin.AccessibleDescription = resources.GetString("lblToBin.AccessibleDescription");
            this.lblToBin.AccessibleName = resources.GetString("lblToBin.AccessibleName");
            this.lblToBin.Anchor = ((System.Windows.Forms.AnchorStyles)(resources.GetObject("lblToBin.Anchor")));
            this.lblToBin.AutoSize = ((bool)(resources.GetObject("lblToBin.AutoSize")));
            this.lblToBin.Dock = ((System.Windows.Forms.DockStyle)(resources.GetObject("lblToBin.Dock")));
            this.lblToBin.Enabled = ((bool)(resources.GetObject("lblToBin.Enabled")));
            this.lblToBin.Font = ((System.Drawing.Font)(resources.GetObject("lblToBin.Font")));
            this.lblToBin.ForeColor = System.Drawing.Color.Maroon;
            this.lblToBin.Image = ((System.Drawing.Image)(resources.GetObject("lblToBin.Image")));
            this.lblToBin.ImageAlign = ((System.Drawing.ContentAlignment)(resources.GetObject("lblToBin.ImageAlign")));
            this.lblToBin.ImageIndex = ((int)(resources.GetObject("lblToBin.ImageIndex")));
            this.lblToBin.ImeMode = ((System.Windows.Forms.ImeMode)(resources.GetObject("lblToBin.ImeMode")));
            this.lblToBin.Location = ((System.Drawing.Point)(resources.GetObject("lblToBin.Location")));
            this.lblToBin.Name = "lblToBin";
            this.lblToBin.RightToLeft = ((System.Windows.Forms.RightToLeft)(resources.GetObject("lblToBin.RightToLeft")));
            this.lblToBin.Size = ((System.Drawing.Size)(resources.GetObject("lblToBin.Size")));
            this.lblToBin.TabIndex = ((int)(resources.GetObject("lblToBin.TabIndex")));
            this.lblToBin.Text = resources.GetString("lblToBin.Text");
            this.lblToBin.TextAlign = ((System.Drawing.ContentAlignment)(resources.GetObject("lblToBin.TextAlign")));
            this.lblToBin.Visible = ((bool)(resources.GetObject("lblToBin.Visible")));
            // 
            // txtToBin
            // 
            this.txtToBin.AccessibleDescription = resources.GetString("txtToBin.AccessibleDescription");
            this.txtToBin.AccessibleName = resources.GetString("txtToBin.AccessibleName");
            this.txtToBin.Anchor = ((System.Windows.Forms.AnchorStyles)(resources.GetObject("txtToBin.Anchor")));
            this.txtToBin.AutoSize = ((bool)(resources.GetObject("txtToBin.AutoSize")));
            this.txtToBin.BackgroundImage = ((System.Drawing.Image)(resources.GetObject("txtToBin.BackgroundImage")));
            this.txtToBin.Dock = ((System.Windows.Forms.DockStyle)(resources.GetObject("txtToBin.Dock")));
            this.txtToBin.Enabled = ((bool)(resources.GetObject("txtToBin.Enabled")));
            this.txtToBin.Font = ((System.Drawing.Font)(resources.GetObject("txtToBin.Font")));
            this.txtToBin.ImeMode = ((System.Windows.Forms.ImeMode)(resources.GetObject("txtToBin.ImeMode")));
            this.txtToBin.Location = ((System.Drawing.Point)(resources.GetObject("txtToBin.Location")));
            this.txtToBin.MaxLength = ((int)(resources.GetObject("txtToBin.MaxLength")));
            this.txtToBin.Multiline = ((bool)(resources.GetObject("txtToBin.Multiline")));
            this.txtToBin.Name = "txtToBin";
            this.txtToBin.PasswordChar = ((char)(resources.GetObject("txtToBin.PasswordChar")));
            this.txtToBin.RightToLeft = ((System.Windows.Forms.RightToLeft)(resources.GetObject("txtToBin.RightToLeft")));
            this.txtToBin.ScrollBars = ((System.Windows.Forms.ScrollBars)(resources.GetObject("txtToBin.ScrollBars")));
            this.txtToBin.Size = ((System.Drawing.Size)(resources.GetObject("txtToBin.Size")));
            this.txtToBin.TabIndex = ((int)(resources.GetObject("txtToBin.TabIndex")));
            this.txtToBin.Text = resources.GetString("txtToBin.Text");
            this.txtToBin.TextAlign = ((System.Windows.Forms.HorizontalAlignment)(resources.GetObject("txtToBin.TextAlign")));
            this.txtToBin.Visible = ((bool)(resources.GetObject("txtToBin.Visible")));
            this.txtToBin.WordWrap = ((bool)(resources.GetObject("txtToBin.WordWrap")));
            this.txtToBin.KeyDown += new System.Windows.Forms.KeyEventHandler(this.txtToBin_KeyDown);
            this.txtToBin.Validating += new System.ComponentModel.CancelEventHandler(this.txtToBin_Validating);
            // 
            // btnPurpose
            // 
            this.btnPurpose.AccessibleDescription = resources.GetString("btnPurpose.AccessibleDescription");
            this.btnPurpose.AccessibleName = resources.GetString("btnPurpose.AccessibleName");
            this.btnPurpose.Anchor = ((System.Windows.Forms.AnchorStyles)(resources.GetObject("btnPurpose.Anchor")));
            this.btnPurpose.BackgroundImage = ((System.Drawing.Image)(resources.GetObject("btnPurpose.BackgroundImage")));
            this.btnPurpose.Dock = ((System.Windows.Forms.DockStyle)(resources.GetObject("btnPurpose.Dock")));
            this.btnPurpose.Enabled = ((bool)(resources.GetObject("btnPurpose.Enabled")));
            this.btnPurpose.FlatStyle = ((System.Windows.Forms.FlatStyle)(resources.GetObject("btnPurpose.FlatStyle")));
            this.btnPurpose.Font = ((System.Drawing.Font)(resources.GetObject("btnPurpose.Font")));
            this.btnPurpose.Image = ((System.Drawing.Image)(resources.GetObject("btnPurpose.Image")));
            this.btnPurpose.ImageAlign = ((System.Drawing.ContentAlignment)(resources.GetObject("btnPurpose.ImageAlign")));
            this.btnPurpose.ImageIndex = ((int)(resources.GetObject("btnPurpose.ImageIndex")));
            this.btnPurpose.ImeMode = ((System.Windows.Forms.ImeMode)(resources.GetObject("btnPurpose.ImeMode")));
            this.btnPurpose.Location = ((System.Drawing.Point)(resources.GetObject("btnPurpose.Location")));
            this.btnPurpose.Name = "btnPurpose";
            this.btnPurpose.RightToLeft = ((System.Windows.Forms.RightToLeft)(resources.GetObject("btnPurpose.RightToLeft")));
            this.btnPurpose.Size = ((System.Drawing.Size)(resources.GetObject("btnPurpose.Size")));
            this.btnPurpose.TabIndex = ((int)(resources.GetObject("btnPurpose.TabIndex")));
            this.btnPurpose.Text = resources.GetString("btnPurpose.Text");
            this.btnPurpose.TextAlign = ((System.Drawing.ContentAlignment)(resources.GetObject("btnPurpose.TextAlign")));
            this.btnPurpose.Visible = ((bool)(resources.GetObject("btnPurpose.Visible")));
            this.btnPurpose.Click += new System.EventHandler(this.btnPurpose_Click);
            // 
            // btnToBin
            // 
            this.btnToBin.AccessibleDescription = resources.GetString("btnToBin.AccessibleDescription");
            this.btnToBin.AccessibleName = resources.GetString("btnToBin.AccessibleName");
            this.btnToBin.Anchor = ((System.Windows.Forms.AnchorStyles)(resources.GetObject("btnToBin.Anchor")));
            this.btnToBin.BackgroundImage = ((System.Drawing.Image)(resources.GetObject("btnToBin.BackgroundImage")));
            this.btnToBin.Dock = ((System.Windows.Forms.DockStyle)(resources.GetObject("btnToBin.Dock")));
            this.btnToBin.Enabled = ((bool)(resources.GetObject("btnToBin.Enabled")));
            this.btnToBin.FlatStyle = ((System.Windows.Forms.FlatStyle)(resources.GetObject("btnToBin.FlatStyle")));
            this.btnToBin.Font = ((System.Drawing.Font)(resources.GetObject("btnToBin.Font")));
            this.btnToBin.Image = ((System.Drawing.Image)(resources.GetObject("btnToBin.Image")));
            this.btnToBin.ImageAlign = ((System.Drawing.ContentAlignment)(resources.GetObject("btnToBin.ImageAlign")));
            this.btnToBin.ImageIndex = ((int)(resources.GetObject("btnToBin.ImageIndex")));
            this.btnToBin.ImeMode = ((System.Windows.Forms.ImeMode)(resources.GetObject("btnToBin.ImeMode")));
            this.btnToBin.Location = ((System.Drawing.Point)(resources.GetObject("btnToBin.Location")));
            this.btnToBin.Name = "btnToBin";
            this.btnToBin.RightToLeft = ((System.Windows.Forms.RightToLeft)(resources.GetObject("btnToBin.RightToLeft")));
            this.btnToBin.Size = ((System.Drawing.Size)(resources.GetObject("btnToBin.Size")));
            this.btnToBin.TabIndex = ((int)(resources.GetObject("btnToBin.TabIndex")));
            this.btnToBin.Text = resources.GetString("btnToBin.Text");
            this.btnToBin.TextAlign = ((System.Drawing.ContentAlignment)(resources.GetObject("btnToBin.TextAlign")));
            this.btnToBin.Visible = ((bool)(resources.GetObject("btnToBin.Visible")));
            this.btnToBin.Click += new System.EventHandler(this.btnToBin_Click);
            // 
            // btnToLocation
            // 
            this.btnToLocation.AccessibleDescription = resources.GetString("btnToLocation.AccessibleDescription");
            this.btnToLocation.AccessibleName = resources.GetString("btnToLocation.AccessibleName");
            this.btnToLocation.Anchor = ((System.Windows.Forms.AnchorStyles)(resources.GetObject("btnToLocation.Anchor")));
            this.btnToLocation.BackgroundImage = ((System.Drawing.Image)(resources.GetObject("btnToLocation.BackgroundImage")));
            this.btnToLocation.Dock = ((System.Windows.Forms.DockStyle)(resources.GetObject("btnToLocation.Dock")));
            this.btnToLocation.Enabled = ((bool)(resources.GetObject("btnToLocation.Enabled")));
            this.btnToLocation.FlatStyle = ((System.Windows.Forms.FlatStyle)(resources.GetObject("btnToLocation.FlatStyle")));
            this.btnToLocation.Font = ((System.Drawing.Font)(resources.GetObject("btnToLocation.Font")));
            this.btnToLocation.Image = ((System.Drawing.Image)(resources.GetObject("btnToLocation.Image")));
            this.btnToLocation.ImageAlign = ((System.Drawing.ContentAlignment)(resources.GetObject("btnToLocation.ImageAlign")));
            this.btnToLocation.ImageIndex = ((int)(resources.GetObject("btnToLocation.ImageIndex")));
            this.btnToLocation.ImeMode = ((System.Windows.Forms.ImeMode)(resources.GetObject("btnToLocation.ImeMode")));
            this.btnToLocation.Location = ((System.Drawing.Point)(resources.GetObject("btnToLocation.Location")));
            this.btnToLocation.Name = "btnToLocation";
            this.btnToLocation.RightToLeft = ((System.Windows.Forms.RightToLeft)(resources.GetObject("btnToLocation.RightToLeft")));
            this.btnToLocation.Size = ((System.Drawing.Size)(resources.GetObject("btnToLocation.Size")));
            this.btnToLocation.TabIndex = ((int)(resources.GetObject("btnToLocation.TabIndex")));
            this.btnToLocation.Text = resources.GetString("btnToLocation.Text");
            this.btnToLocation.TextAlign = ((System.Drawing.ContentAlignment)(resources.GetObject("btnToLocation.TextAlign")));
            this.btnToLocation.Visible = ((bool)(resources.GetObject("btnToLocation.Visible")));
            this.btnToLocation.Click += new System.EventHandler(this.btnToLocation_Click);
            // 
            // btnShift
            // 
            this.btnShift.AccessibleDescription = resources.GetString("btnShift.AccessibleDescription");
            this.btnShift.AccessibleName = resources.GetString("btnShift.AccessibleName");
            this.btnShift.Anchor = ((System.Windows.Forms.AnchorStyles)(resources.GetObject("btnShift.Anchor")));
            this.btnShift.BackgroundImage = ((System.Drawing.Image)(resources.GetObject("btnShift.BackgroundImage")));
            this.btnShift.Dock = ((System.Windows.Forms.DockStyle)(resources.GetObject("btnShift.Dock")));
            this.btnShift.Enabled = ((bool)(resources.GetObject("btnShift.Enabled")));
            this.btnShift.FlatStyle = ((System.Windows.Forms.FlatStyle)(resources.GetObject("btnShift.FlatStyle")));
            this.btnShift.Font = ((System.Drawing.Font)(resources.GetObject("btnShift.Font")));
            this.btnShift.Image = ((System.Drawing.Image)(resources.GetObject("btnShift.Image")));
            this.btnShift.ImageAlign = ((System.Drawing.ContentAlignment)(resources.GetObject("btnShift.ImageAlign")));
            this.btnShift.ImageIndex = ((int)(resources.GetObject("btnShift.ImageIndex")));
            this.btnShift.ImeMode = ((System.Windows.Forms.ImeMode)(resources.GetObject("btnShift.ImeMode")));
            this.btnShift.Location = ((System.Drawing.Point)(resources.GetObject("btnShift.Location")));
            this.btnShift.Name = "btnShift";
            this.btnShift.RightToLeft = ((System.Windows.Forms.RightToLeft)(resources.GetObject("btnShift.RightToLeft")));
            this.btnShift.Size = ((System.Drawing.Size)(resources.GetObject("btnShift.Size")));
            this.btnShift.TabIndex = ((int)(resources.GetObject("btnShift.TabIndex")));
            this.btnShift.Text = resources.GetString("btnShift.Text");
            this.btnShift.TextAlign = ((System.Drawing.ContentAlignment)(resources.GetObject("btnShift.TextAlign")));
            this.btnShift.Visible = ((bool)(resources.GetObject("btnShift.Visible")));
            this.btnShift.Click += new System.EventHandler(this.btnShift_Click);
            // 
            // lblShift
            // 
            this.lblShift.AccessibleDescription = resources.GetString("lblShift.AccessibleDescription");
            this.lblShift.AccessibleName = resources.GetString("lblShift.AccessibleName");
            this.lblShift.Anchor = ((System.Windows.Forms.AnchorStyles)(resources.GetObject("lblShift.Anchor")));
            this.lblShift.AutoSize = ((bool)(resources.GetObject("lblShift.AutoSize")));
            this.lblShift.Dock = ((System.Windows.Forms.DockStyle)(resources.GetObject("lblShift.Dock")));
            this.lblShift.Enabled = ((bool)(resources.GetObject("lblShift.Enabled")));
            this.lblShift.Font = ((System.Drawing.Font)(resources.GetObject("lblShift.Font")));
            this.lblShift.Image = ((System.Drawing.Image)(resources.GetObject("lblShift.Image")));
            this.lblShift.ImageAlign = ((System.Drawing.ContentAlignment)(resources.GetObject("lblShift.ImageAlign")));
            this.lblShift.ImageIndex = ((int)(resources.GetObject("lblShift.ImageIndex")));
            this.lblShift.ImeMode = ((System.Windows.Forms.ImeMode)(resources.GetObject("lblShift.ImeMode")));
            this.lblShift.Location = ((System.Drawing.Point)(resources.GetObject("lblShift.Location")));
            this.lblShift.Name = "lblShift";
            this.lblShift.RightToLeft = ((System.Windows.Forms.RightToLeft)(resources.GetObject("lblShift.RightToLeft")));
            this.lblShift.Size = ((System.Drawing.Size)(resources.GetObject("lblShift.Size")));
            this.lblShift.TabIndex = ((int)(resources.GetObject("lblShift.TabIndex")));
            this.lblShift.Text = resources.GetString("lblShift.Text");
            this.lblShift.TextAlign = ((System.Drawing.ContentAlignment)(resources.GetObject("lblShift.TextAlign")));
            this.lblShift.Visible = ((bool)(resources.GetObject("lblShift.Visible")));
            // 
            // txtShift
            // 
            this.txtShift.AccessibleDescription = resources.GetString("txtShift.AccessibleDescription");
            this.txtShift.AccessibleName = resources.GetString("txtShift.AccessibleName");
            this.txtShift.Anchor = ((System.Windows.Forms.AnchorStyles)(resources.GetObject("txtShift.Anchor")));
            this.txtShift.AutoSize = ((bool)(resources.GetObject("txtShift.AutoSize")));
            this.txtShift.BackgroundImage = ((System.Drawing.Image)(resources.GetObject("txtShift.BackgroundImage")));
            this.txtShift.Dock = ((System.Windows.Forms.DockStyle)(resources.GetObject("txtShift.Dock")));
            this.txtShift.Enabled = ((bool)(resources.GetObject("txtShift.Enabled")));
            this.txtShift.Font = ((System.Drawing.Font)(resources.GetObject("txtShift.Font")));
            this.txtShift.ImeMode = ((System.Windows.Forms.ImeMode)(resources.GetObject("txtShift.ImeMode")));
            this.txtShift.Location = ((System.Drawing.Point)(resources.GetObject("txtShift.Location")));
            this.txtShift.MaxLength = ((int)(resources.GetObject("txtShift.MaxLength")));
            this.txtShift.Multiline = ((bool)(resources.GetObject("txtShift.Multiline")));
            this.txtShift.Name = "txtShift";
            this.txtShift.PasswordChar = ((char)(resources.GetObject("txtShift.PasswordChar")));
            this.txtShift.RightToLeft = ((System.Windows.Forms.RightToLeft)(resources.GetObject("txtShift.RightToLeft")));
            this.txtShift.ScrollBars = ((System.Windows.Forms.ScrollBars)(resources.GetObject("txtShift.ScrollBars")));
            this.txtShift.Size = ((System.Drawing.Size)(resources.GetObject("txtShift.Size")));
            this.txtShift.TabIndex = ((int)(resources.GetObject("txtShift.TabIndex")));
            this.txtShift.Text = resources.GetString("txtShift.Text");
            this.txtShift.TextAlign = ((System.Windows.Forms.HorizontalAlignment)(resources.GetObject("txtShift.TextAlign")));
            this.txtShift.Visible = ((bool)(resources.GetObject("txtShift.Visible")));
            this.txtShift.WordWrap = ((bool)(resources.GetObject("txtShift.WordWrap")));
            this.txtShift.KeyDown += new System.Windows.Forms.KeyEventHandler(this.txtShift_KeyDown);
            this.txtShift.Validating += new System.ComponentModel.CancelEventHandler(this.txtShift_Validating);
            // 
            // btnPrint
            // 
            this.btnPrint.AccessibleDescription = resources.GetString("btnPrint.AccessibleDescription");
            this.btnPrint.AccessibleName = resources.GetString("btnPrint.AccessibleName");
            this.btnPrint.Anchor = ((System.Windows.Forms.AnchorStyles)(resources.GetObject("btnPrint.Anchor")));
            this.btnPrint.BackgroundImage = ((System.Drawing.Image)(resources.GetObject("btnPrint.BackgroundImage")));
            this.btnPrint.Dock = ((System.Windows.Forms.DockStyle)(resources.GetObject("btnPrint.Dock")));
            this.btnPrint.Enabled = ((bool)(resources.GetObject("btnPrint.Enabled")));
            this.btnPrint.FlatStyle = ((System.Windows.Forms.FlatStyle)(resources.GetObject("btnPrint.FlatStyle")));
            this.btnPrint.Font = ((System.Drawing.Font)(resources.GetObject("btnPrint.Font")));
            this.btnPrint.Image = ((System.Drawing.Image)(resources.GetObject("btnPrint.Image")));
            this.btnPrint.ImageAlign = ((System.Drawing.ContentAlignment)(resources.GetObject("btnPrint.ImageAlign")));
            this.btnPrint.ImageIndex = ((int)(resources.GetObject("btnPrint.ImageIndex")));
            this.btnPrint.ImeMode = ((System.Windows.Forms.ImeMode)(resources.GetObject("btnPrint.ImeMode")));
            this.btnPrint.Location = ((System.Drawing.Point)(resources.GetObject("btnPrint.Location")));
            this.btnPrint.Name = "btnPrint";
            this.btnPrint.RightToLeft = ((System.Windows.Forms.RightToLeft)(resources.GetObject("btnPrint.RightToLeft")));
            this.btnPrint.Size = ((System.Drawing.Size)(resources.GetObject("btnPrint.Size")));
            this.btnPrint.TabIndex = ((int)(resources.GetObject("btnPrint.TabIndex")));
            this.btnPrint.Text = resources.GetString("btnPrint.Text");
            this.btnPrint.TextAlign = ((System.Drawing.ContentAlignment)(resources.GetObject("btnPrint.TextAlign")));
            this.btnPrint.Visible = ((bool)(resources.GetObject("btnPrint.Visible")));
            this.btnPrint.EnabledChanged += new System.EventHandler(this.btnPrint_EnabledChanged);
            // 
            // btnPrintConfiguration
            // 
            this.btnPrintConfiguration.AccessibleDescription = resources.GetString("btnPrintConfiguration.AccessibleDescription");
            this.btnPrintConfiguration.AccessibleName = resources.GetString("btnPrintConfiguration.AccessibleName");
            this.btnPrintConfiguration.Anchor = ((System.Windows.Forms.AnchorStyles)(resources.GetObject("btnPrintConfiguration.Anchor")));
            this.btnPrintConfiguration.BackgroundImage = ((System.Drawing.Image)(resources.GetObject("btnPrintConfiguration.BackgroundImage")));
            this.btnPrintConfiguration.Dock = ((System.Windows.Forms.DockStyle)(resources.GetObject("btnPrintConfiguration.Dock")));
            this.btnPrintConfiguration.Enabled = ((bool)(resources.GetObject("btnPrintConfiguration.Enabled")));
            this.btnPrintConfiguration.FlatStyle = ((System.Windows.Forms.FlatStyle)(resources.GetObject("btnPrintConfiguration.FlatStyle")));
            this.btnPrintConfiguration.Font = ((System.Drawing.Font)(resources.GetObject("btnPrintConfiguration.Font")));
            this.btnPrintConfiguration.Image = ((System.Drawing.Image)(resources.GetObject("btnPrintConfiguration.Image")));
            this.btnPrintConfiguration.ImageAlign = ((System.Drawing.ContentAlignment)(resources.GetObject("btnPrintConfiguration.ImageAlign")));
            this.btnPrintConfiguration.ImageIndex = ((int)(resources.GetObject("btnPrintConfiguration.ImageIndex")));
            this.btnPrintConfiguration.ImeMode = ((System.Windows.Forms.ImeMode)(resources.GetObject("btnPrintConfiguration.ImeMode")));
            this.btnPrintConfiguration.Location = ((System.Drawing.Point)(resources.GetObject("btnPrintConfiguration.Location")));
            this.btnPrintConfiguration.Name = "btnPrintConfiguration";
            this.btnPrintConfiguration.RightToLeft = ((System.Windows.Forms.RightToLeft)(resources.GetObject("btnPrintConfiguration.RightToLeft")));
            this.btnPrintConfiguration.Size = ((System.Drawing.Size)(resources.GetObject("btnPrintConfiguration.Size")));
            this.btnPrintConfiguration.TabIndex = ((int)(resources.GetObject("btnPrintConfiguration.TabIndex")));
            this.btnPrintConfiguration.Text = resources.GetString("btnPrintConfiguration.Text");
            this.btnPrintConfiguration.TextAlign = ((System.Drawing.ContentAlignment)(resources.GetObject("btnPrintConfiguration.TextAlign")));
            this.btnPrintConfiguration.Visible = ((bool)(resources.GetObject("btnPrintConfiguration.Visible")));
            // 
            // lblFromBin
            // 
            this.lblFromBin.AccessibleDescription = resources.GetString("lblFromBin.AccessibleDescription");
            this.lblFromBin.AccessibleName = resources.GetString("lblFromBin.AccessibleName");
            this.lblFromBin.Anchor = ((System.Windows.Forms.AnchorStyles)(resources.GetObject("lblFromBin.Anchor")));
            this.lblFromBin.AutoSize = ((bool)(resources.GetObject("lblFromBin.AutoSize")));
            this.lblFromBin.Dock = ((System.Windows.Forms.DockStyle)(resources.GetObject("lblFromBin.Dock")));
            this.lblFromBin.Enabled = ((bool)(resources.GetObject("lblFromBin.Enabled")));
            this.lblFromBin.Font = ((System.Drawing.Font)(resources.GetObject("lblFromBin.Font")));
            this.lblFromBin.Image = ((System.Drawing.Image)(resources.GetObject("lblFromBin.Image")));
            this.lblFromBin.ImageAlign = ((System.Drawing.ContentAlignment)(resources.GetObject("lblFromBin.ImageAlign")));
            this.lblFromBin.ImageIndex = ((int)(resources.GetObject("lblFromBin.ImageIndex")));
            this.lblFromBin.ImeMode = ((System.Windows.Forms.ImeMode)(resources.GetObject("lblFromBin.ImeMode")));
            this.lblFromBin.Location = ((System.Drawing.Point)(resources.GetObject("lblFromBin.Location")));
            this.lblFromBin.Name = "lblFromBin";
            this.lblFromBin.RightToLeft = ((System.Windows.Forms.RightToLeft)(resources.GetObject("lblFromBin.RightToLeft")));
            this.lblFromBin.Size = ((System.Drawing.Size)(resources.GetObject("lblFromBin.Size")));
            this.lblFromBin.TabIndex = ((int)(resources.GetObject("lblFromBin.TabIndex")));
            this.lblFromBin.Text = resources.GetString("lblFromBin.Text");
            this.lblFromBin.TextAlign = ((System.Drawing.ContentAlignment)(resources.GetObject("lblFromBin.TextAlign")));
            this.lblFromBin.Visible = ((bool)(resources.GetObject("lblFromBin.Visible")));
            // 
            // lblFromLoc
            // 
            this.lblFromLoc.AccessibleDescription = resources.GetString("lblFromLoc.AccessibleDescription");
            this.lblFromLoc.AccessibleName = resources.GetString("lblFromLoc.AccessibleName");
            this.lblFromLoc.Anchor = ((System.Windows.Forms.AnchorStyles)(resources.GetObject("lblFromLoc.Anchor")));
            this.lblFromLoc.AutoSize = ((bool)(resources.GetObject("lblFromLoc.AutoSize")));
            this.lblFromLoc.Dock = ((System.Windows.Forms.DockStyle)(resources.GetObject("lblFromLoc.Dock")));
            this.lblFromLoc.Enabled = ((bool)(resources.GetObject("lblFromLoc.Enabled")));
            this.lblFromLoc.Font = ((System.Drawing.Font)(resources.GetObject("lblFromLoc.Font")));
            this.lblFromLoc.Image = ((System.Drawing.Image)(resources.GetObject("lblFromLoc.Image")));
            this.lblFromLoc.ImageAlign = ((System.Drawing.ContentAlignment)(resources.GetObject("lblFromLoc.ImageAlign")));
            this.lblFromLoc.ImageIndex = ((int)(resources.GetObject("lblFromLoc.ImageIndex")));
            this.lblFromLoc.ImeMode = ((System.Windows.Forms.ImeMode)(resources.GetObject("lblFromLoc.ImeMode")));
            this.lblFromLoc.Location = ((System.Drawing.Point)(resources.GetObject("lblFromLoc.Location")));
            this.lblFromLoc.Name = "lblFromLoc";
            this.lblFromLoc.RightToLeft = ((System.Windows.Forms.RightToLeft)(resources.GetObject("lblFromLoc.RightToLeft")));
            this.lblFromLoc.Size = ((System.Drawing.Size)(resources.GetObject("lblFromLoc.Size")));
            this.lblFromLoc.TabIndex = ((int)(resources.GetObject("lblFromLoc.TabIndex")));
            this.lblFromLoc.Text = resources.GetString("lblFromLoc.Text");
            this.lblFromLoc.TextAlign = ((System.Drawing.ContentAlignment)(resources.GetObject("lblFromLoc.TextAlign")));
            this.lblFromLoc.Visible = ((bool)(resources.GetObject("lblFromLoc.Visible")));
            // 
            // dtmIssueDay
            // 
            this.dtmIssueDay.AcceptsEscape = ((bool)(resources.GetObject("dtmIssueDay.AcceptsEscape")));
            this.dtmIssueDay.AccessibleDescription = resources.GetString("dtmIssueDay.AccessibleDescription");
            this.dtmIssueDay.AccessibleName = resources.GetString("dtmIssueDay.AccessibleName");
            this.dtmIssueDay.Anchor = ((System.Windows.Forms.AnchorStyles)(resources.GetObject("dtmIssueDay.Anchor")));
            this.dtmIssueDay.AutoSize = ((bool)(resources.GetObject("dtmIssueDay.AutoSize")));
            this.dtmIssueDay.BackgroundImage = ((System.Drawing.Image)(resources.GetObject("dtmIssueDay.BackgroundImage")));
            this.dtmIssueDay.BorderStyle = ((System.Windows.Forms.BorderStyle)(resources.GetObject("dtmIssueDay.BorderStyle")));
            // 
            // dtmIssueDay.Calendar
            // 
            this.dtmIssueDay.Calendar.AccessibleDescription = resources.GetString("dtmIssueDay.Calendar.AccessibleDescription");
            this.dtmIssueDay.Calendar.AccessibleName = resources.GetString("dtmIssueDay.Calendar.AccessibleName");
            this.dtmIssueDay.Calendar.AnnuallyBoldedDates = ((System.DateTime[])(resources.GetObject("dtmIssueDay.Calendar.AnnuallyBoldedDates")));
            this.dtmIssueDay.Calendar.BackgroundImage = ((System.Drawing.Image)(resources.GetObject("dtmIssueDay.Calendar.BackgroundImage")));
            this.dtmIssueDay.Calendar.BoldedDates = ((System.DateTime[])(resources.GetObject("dtmIssueDay.Calendar.BoldedDates")));
            this.dtmIssueDay.Calendar.CalendarDimensions = ((System.Drawing.Size)(resources.GetObject("dtmIssueDay.Calendar.CalendarDimensions")));
            this.dtmIssueDay.Calendar.Enabled = ((bool)(resources.GetObject("dtmIssueDay.Calendar.Enabled")));
            this.dtmIssueDay.Calendar.FirstDayOfWeek = ((System.Windows.Forms.Day)(resources.GetObject("dtmIssueDay.Calendar.FirstDayOfWeek")));
            this.dtmIssueDay.Calendar.Font = ((System.Drawing.Font)(resources.GetObject("dtmIssueDay.Calendar.Font")));
            this.dtmIssueDay.Calendar.ImeMode = ((System.Windows.Forms.ImeMode)(resources.GetObject("dtmIssueDay.Calendar.ImeMode")));
            this.dtmIssueDay.Calendar.MonthlyBoldedDates = ((System.DateTime[])(resources.GetObject("dtmIssueDay.Calendar.MonthlyBoldedDates")));
            this.dtmIssueDay.Calendar.RightToLeft = ((System.Windows.Forms.RightToLeft)(resources.GetObject("dtmIssueDay.Calendar.RightToLeft")));
            this.dtmIssueDay.Calendar.ShowClearButton = ((bool)(resources.GetObject("dtmIssueDay.Calendar.ShowClearButton")));
            this.dtmIssueDay.Calendar.ShowTodayButton = ((bool)(resources.GetObject("dtmIssueDay.Calendar.ShowTodayButton")));
            this.dtmIssueDay.Calendar.ShowWeekNumbers = ((bool)(resources.GetObject("dtmIssueDay.Calendar.ShowWeekNumbers")));
            this.dtmIssueDay.CaseSensitive = ((bool)(resources.GetObject("dtmIssueDay.CaseSensitive")));
            this.dtmIssueDay.Culture = ((int)(resources.GetObject("dtmIssueDay.Culture")));
            this.dtmIssueDay.CurrentTimeZone = ((bool)(resources.GetObject("dtmIssueDay.CurrentTimeZone")));
            this.dtmIssueDay.CustomFormat = resources.GetString("dtmIssueDay.CustomFormat");
            this.dtmIssueDay.DaylightTimeAdjustment = ((C1.Win.C1Input.DaylightTimeAdjustmentEnum)(resources.GetObject("dtmIssueDay.DaylightTimeAdjustment")));
            this.dtmIssueDay.DisplayFormat.CustomFormat = resources.GetString("dtmIssueDay.DisplayFormat.CustomFormat");
            this.dtmIssueDay.DisplayFormat.FormatType = ((C1.Win.C1Input.FormatTypeEnum)(resources.GetObject("dtmIssueDay.DisplayFormat.FormatType")));
            this.dtmIssueDay.DisplayFormat.Inherit = ((C1.Win.C1Input.FormatInfoInheritFlags)(resources.GetObject("dtmIssueDay.DisplayFormat.Inherit")));
            this.dtmIssueDay.DisplayFormat.NullText = resources.GetString("dtmIssueDay.DisplayFormat.NullText");
            this.dtmIssueDay.DisplayFormat.TrimEnd = ((bool)(resources.GetObject("dtmIssueDay.DisplayFormat.TrimEnd")));
            this.dtmIssueDay.DisplayFormat.TrimStart = ((bool)(resources.GetObject("dtmIssueDay.DisplayFormat.TrimStart")));
            this.dtmIssueDay.Dock = ((System.Windows.Forms.DockStyle)(resources.GetObject("dtmIssueDay.Dock")));
            this.dtmIssueDay.DropDownFormAlign = ((C1.Win.C1Input.DropDownFormAlignmentEnum)(resources.GetObject("dtmIssueDay.DropDownFormAlign")));
            this.dtmIssueDay.EditFormat.CustomFormat = resources.GetString("dtmIssueDay.EditFormat.CustomFormat");
            this.dtmIssueDay.EditFormat.FormatType = ((C1.Win.C1Input.FormatTypeEnum)(resources.GetObject("dtmIssueDay.EditFormat.FormatType")));
            this.dtmIssueDay.EditFormat.Inherit = ((C1.Win.C1Input.FormatInfoInheritFlags)(resources.GetObject("dtmIssueDay.EditFormat.Inherit")));
            this.dtmIssueDay.EditFormat.NullText = resources.GetString("dtmIssueDay.EditFormat.NullText");
            this.dtmIssueDay.EditFormat.TrimEnd = ((bool)(resources.GetObject("dtmIssueDay.EditFormat.TrimEnd")));
            this.dtmIssueDay.EditFormat.TrimStart = ((bool)(resources.GetObject("dtmIssueDay.EditFormat.TrimStart")));
            this.dtmIssueDay.EditMask = resources.GetString("dtmIssueDay.EditMask");
            this.dtmIssueDay.EmptyAsNull = ((bool)(resources.GetObject("dtmIssueDay.EmptyAsNull")));
            this.dtmIssueDay.Enabled = ((bool)(resources.GetObject("dtmIssueDay.Enabled")));
            this.dtmIssueDay.ErrorInfo.BeepOnError = ((bool)(resources.GetObject("dtmIssueDay.ErrorInfo.BeepOnError")));
            this.dtmIssueDay.ErrorInfo.ErrorMessage = resources.GetString("dtmIssueDay.ErrorInfo.ErrorMessage");
            this.dtmIssueDay.ErrorInfo.ErrorMessageCaption = resources.GetString("dtmIssueDay.ErrorInfo.ErrorMessageCaption");
            this.dtmIssueDay.ErrorInfo.ShowErrorMessage = ((bool)(resources.GetObject("dtmIssueDay.ErrorInfo.ShowErrorMessage")));
            this.dtmIssueDay.ErrorInfo.ValueOnError = ((object)(resources.GetObject("dtmIssueDay.ErrorInfo.ValueOnError")));
            this.dtmIssueDay.Font = ((System.Drawing.Font)(resources.GetObject("dtmIssueDay.Font")));
            this.dtmIssueDay.FormatType = ((C1.Win.C1Input.FormatTypeEnum)(resources.GetObject("dtmIssueDay.FormatType")));
            this.dtmIssueDay.GapHeight = ((int)(resources.GetObject("dtmIssueDay.GapHeight")));
            this.dtmIssueDay.GMTOffset = ((System.TimeSpan)(resources.GetObject("dtmIssueDay.GMTOffset")));
            this.dtmIssueDay.ImeMode = ((System.Windows.Forms.ImeMode)(resources.GetObject("dtmIssueDay.ImeMode")));
            this.dtmIssueDay.InitialSelection = ((C1.Win.C1Input.InitialSelectionEnum)(resources.GetObject("dtmIssueDay.InitialSelection")));
            this.dtmIssueDay.Location = ((System.Drawing.Point)(resources.GetObject("dtmIssueDay.Location")));
            this.dtmIssueDay.MaskInfo.AutoTabWhenFilled = ((bool)(resources.GetObject("dtmIssueDay.MaskInfo.AutoTabWhenFilled")));
            this.dtmIssueDay.MaskInfo.CaseSensitive = ((bool)(resources.GetObject("dtmIssueDay.MaskInfo.CaseSensitive")));
            this.dtmIssueDay.MaskInfo.CopyWithLiterals = ((bool)(resources.GetObject("dtmIssueDay.MaskInfo.CopyWithLiterals")));
            this.dtmIssueDay.MaskInfo.EditMask = resources.GetString("dtmIssueDay.MaskInfo.EditMask");
            this.dtmIssueDay.MaskInfo.EmptyAsNull = ((bool)(resources.GetObject("dtmIssueDay.MaskInfo.EmptyAsNull")));
            this.dtmIssueDay.MaskInfo.ErrorMessage = resources.GetString("dtmIssueDay.MaskInfo.ErrorMessage");
            this.dtmIssueDay.MaskInfo.Inherit = ((C1.Win.C1Input.MaskInfoInheritFlags)(resources.GetObject("dtmIssueDay.MaskInfo.Inherit")));
            this.dtmIssueDay.MaskInfo.PromptChar = ((char)(resources.GetObject("dtmIssueDay.MaskInfo.PromptChar")));
            this.dtmIssueDay.MaskInfo.ShowLiterals = ((C1.Win.C1Input.ShowLiteralsEnum)(resources.GetObject("dtmIssueDay.MaskInfo.ShowLiterals")));
            this.dtmIssueDay.MaskInfo.StoredEmptyChar = ((char)(resources.GetObject("dtmIssueDay.MaskInfo.StoredEmptyChar")));
            this.dtmIssueDay.MaxLength = ((int)(resources.GetObject("dtmIssueDay.MaxLength")));
            this.dtmIssueDay.Name = "dtmIssueDay";
            this.dtmIssueDay.NullText = resources.GetString("dtmIssueDay.NullText");
            this.dtmIssueDay.ParseInfo.CaseSensitive = ((bool)(resources.GetObject("dtmIssueDay.ParseInfo.CaseSensitive")));
            this.dtmIssueDay.ParseInfo.CustomFormat = resources.GetString("dtmIssueDay.ParseInfo.CustomFormat");
            this.dtmIssueDay.ParseInfo.DateTimeStyle = ((C1.Win.C1Input.DateTimeStyleFlags)(resources.GetObject("dtmIssueDay.ParseInfo.DateTimeStyle")));
            this.dtmIssueDay.ParseInfo.EmptyAsNull = ((bool)(resources.GetObject("dtmIssueDay.ParseInfo.EmptyAsNull")));
            this.dtmIssueDay.ParseInfo.ErrorMessage = resources.GetString("dtmIssueDay.ParseInfo.ErrorMessage");
            this.dtmIssueDay.ParseInfo.FormatType = ((C1.Win.C1Input.FormatTypeEnum)(resources.GetObject("dtmIssueDay.ParseInfo.FormatType")));
            this.dtmIssueDay.ParseInfo.Inherit = ((C1.Win.C1Input.ParseInfoInheritFlags)(resources.GetObject("dtmIssueDay.ParseInfo.Inherit")));
            this.dtmIssueDay.ParseInfo.NullText = resources.GetString("dtmIssueDay.ParseInfo.NullText");
            this.dtmIssueDay.ParseInfo.TrimEnd = ((bool)(resources.GetObject("dtmIssueDay.ParseInfo.TrimEnd")));
            this.dtmIssueDay.ParseInfo.TrimStart = ((bool)(resources.GetObject("dtmIssueDay.ParseInfo.TrimStart")));
            this.dtmIssueDay.PasswordChar = ((char)(resources.GetObject("dtmIssueDay.PasswordChar")));
            this.dtmIssueDay.PostValidation.CaseSensitive = ((bool)(resources.GetObject("dtmIssueDay.PostValidation.CaseSensitive")));
            this.dtmIssueDay.PostValidation.ErrorMessage = resources.GetString("dtmIssueDay.PostValidation.ErrorMessage");
            this.dtmIssueDay.PostValidation.Inherit = ((C1.Win.C1Input.PostValidationInheritFlags)(resources.GetObject("dtmIssueDay.PostValidation.Inherit")));
            this.dtmIssueDay.PostValidation.Intervals.AddRange(new C1.Win.C1Input.ValueInterval[] {
																									  ((C1.Win.C1Input.ValueInterval)(resources.GetObject("dtmIssueDay.PostValidation.Intervals")))});
            this.dtmIssueDay.PostValidation.Validation = ((C1.Win.C1Input.PostValidationTypeEnum)(resources.GetObject("dtmIssueDay.PostValidation.Validation")));
            this.dtmIssueDay.PostValidation.Values = ((System.Array)(resources.GetObject("dtmIssueDay.PostValidation.Values")));
            this.dtmIssueDay.PostValidation.ValuesExcluded = ((System.Array)(resources.GetObject("dtmIssueDay.PostValidation.ValuesExcluded")));
            this.dtmIssueDay.PreValidation.CaseSensitive = ((bool)(resources.GetObject("dtmIssueDay.PreValidation.CaseSensitive")));
            this.dtmIssueDay.PreValidation.ErrorMessage = resources.GetString("dtmIssueDay.PreValidation.ErrorMessage");
            this.dtmIssueDay.PreValidation.Inherit = ((C1.Win.C1Input.PreValidationInheritFlags)(resources.GetObject("dtmIssueDay.PreValidation.Inherit")));
            this.dtmIssueDay.PreValidation.ItemSeparator = resources.GetString("dtmIssueDay.PreValidation.ItemSeparator");
            this.dtmIssueDay.PreValidation.PatternString = resources.GetString("dtmIssueDay.PreValidation.PatternString");
            this.dtmIssueDay.PreValidation.RegexOptions = ((C1.Win.C1Input.RegexOptionFlags)(resources.GetObject("dtmIssueDay.PreValidation.RegexOptions")));
            this.dtmIssueDay.PreValidation.TrimEnd = ((bool)(resources.GetObject("dtmIssueDay.PreValidation.TrimEnd")));
            this.dtmIssueDay.PreValidation.TrimStart = ((bool)(resources.GetObject("dtmIssueDay.PreValidation.TrimStart")));
            this.dtmIssueDay.PreValidation.Validation = ((C1.Win.C1Input.PreValidationTypeEnum)(resources.GetObject("dtmIssueDay.PreValidation.Validation")));
            this.dtmIssueDay.ReadOnly = true;
            this.dtmIssueDay.RightToLeft = ((System.Windows.Forms.RightToLeft)(resources.GetObject("dtmIssueDay.RightToLeft")));
            this.dtmIssueDay.ShowFocusRectangle = ((bool)(resources.GetObject("dtmIssueDay.ShowFocusRectangle")));
            this.dtmIssueDay.Size = ((System.Drawing.Size)(resources.GetObject("dtmIssueDay.Size")));
            this.dtmIssueDay.TabIndex = ((int)(resources.GetObject("dtmIssueDay.TabIndex")));
            this.dtmIssueDay.Tag = ((object)(resources.GetObject("dtmIssueDay.Tag")));
            this.dtmIssueDay.TextAlign = ((System.Windows.Forms.HorizontalAlignment)(resources.GetObject("dtmIssueDay.TextAlign")));
            this.dtmIssueDay.TrimEnd = ((bool)(resources.GetObject("dtmIssueDay.TrimEnd")));
            this.dtmIssueDay.TrimStart = ((bool)(resources.GetObject("dtmIssueDay.TrimStart")));
            this.dtmIssueDay.UserCultureOverride = ((bool)(resources.GetObject("dtmIssueDay.UserCultureOverride")));
            this.dtmIssueDay.Value = ((object)(resources.GetObject("dtmIssueDay.Value")));
            this.dtmIssueDay.VerticalAlign = ((C1.Win.C1Input.VerticalAlignEnum)(resources.GetObject("dtmIssueDay.VerticalAlign")));
            this.dtmIssueDay.Visible = ((bool)(resources.GetObject("dtmIssueDay.Visible")));
            this.dtmIssueDay.VisibleButtons = ((C1.Win.C1Input.DropDownControlButtonFlags)(resources.GetObject("dtmIssueDay.VisibleButtons")));
            // 
            // lblIssueDay
            // 
            this.lblIssueDay.AccessibleDescription = resources.GetString("lblIssueDay.AccessibleDescription");
            this.lblIssueDay.AccessibleName = resources.GetString("lblIssueDay.AccessibleName");
            this.lblIssueDay.Anchor = ((System.Windows.Forms.AnchorStyles)(resources.GetObject("lblIssueDay.Anchor")));
            this.lblIssueDay.AutoSize = ((bool)(resources.GetObject("lblIssueDay.AutoSize")));
            this.lblIssueDay.Dock = ((System.Windows.Forms.DockStyle)(resources.GetObject("lblIssueDay.Dock")));
            this.lblIssueDay.Enabled = ((bool)(resources.GetObject("lblIssueDay.Enabled")));
            this.lblIssueDay.Font = ((System.Drawing.Font)(resources.GetObject("lblIssueDay.Font")));
            this.lblIssueDay.ForeColor = System.Drawing.Color.Maroon;
            this.lblIssueDay.Image = ((System.Drawing.Image)(resources.GetObject("lblIssueDay.Image")));
            this.lblIssueDay.ImageAlign = ((System.Drawing.ContentAlignment)(resources.GetObject("lblIssueDay.ImageAlign")));
            this.lblIssueDay.ImageIndex = ((int)(resources.GetObject("lblIssueDay.ImageIndex")));
            this.lblIssueDay.ImeMode = ((System.Windows.Forms.ImeMode)(resources.GetObject("lblIssueDay.ImeMode")));
            this.lblIssueDay.Location = ((System.Drawing.Point)(resources.GetObject("lblIssueDay.Location")));
            this.lblIssueDay.Name = "lblIssueDay";
            this.lblIssueDay.RightToLeft = ((System.Windows.Forms.RightToLeft)(resources.GetObject("lblIssueDay.RightToLeft")));
            this.lblIssueDay.Size = ((System.Drawing.Size)(resources.GetObject("lblIssueDay.Size")));
            this.lblIssueDay.TabIndex = ((int)(resources.GetObject("lblIssueDay.TabIndex")));
            this.lblIssueDay.Text = resources.GetString("lblIssueDay.Text");
            this.lblIssueDay.TextAlign = ((System.Drawing.ContentAlignment)(resources.GetObject("lblIssueDay.TextAlign")));
            this.lblIssueDay.Visible = ((bool)(resources.GetObject("lblIssueDay.Visible")));
            // 
            // btnDelete
            // 
            this.btnDelete.AccessibleDescription = resources.GetString("btnDelete.AccessibleDescription");
            this.btnDelete.AccessibleName = resources.GetString("btnDelete.AccessibleName");
            this.btnDelete.Anchor = ((System.Windows.Forms.AnchorStyles)(resources.GetObject("btnDelete.Anchor")));
            this.btnDelete.BackgroundImage = ((System.Drawing.Image)(resources.GetObject("btnDelete.BackgroundImage")));
            this.btnDelete.Dock = ((System.Windows.Forms.DockStyle)(resources.GetObject("btnDelete.Dock")));
            this.btnDelete.Enabled = ((bool)(resources.GetObject("btnDelete.Enabled")));
            this.btnDelete.FlatStyle = ((System.Windows.Forms.FlatStyle)(resources.GetObject("btnDelete.FlatStyle")));
            this.btnDelete.Font = ((System.Drawing.Font)(resources.GetObject("btnDelete.Font")));
            this.btnDelete.Image = ((System.Drawing.Image)(resources.GetObject("btnDelete.Image")));
            this.btnDelete.ImageAlign = ((System.Drawing.ContentAlignment)(resources.GetObject("btnDelete.ImageAlign")));
            this.btnDelete.ImageIndex = ((int)(resources.GetObject("btnDelete.ImageIndex")));
            this.btnDelete.ImeMode = ((System.Windows.Forms.ImeMode)(resources.GetObject("btnDelete.ImeMode")));
            this.btnDelete.Location = ((System.Drawing.Point)(resources.GetObject("btnDelete.Location")));
            this.btnDelete.Name = "btnDelete";
            this.btnDelete.RightToLeft = ((System.Windows.Forms.RightToLeft)(resources.GetObject("btnDelete.RightToLeft")));
            this.btnDelete.Size = ((System.Drawing.Size)(resources.GetObject("btnDelete.Size")));
            this.btnDelete.TabIndex = ((int)(resources.GetObject("btnDelete.TabIndex")));
            this.btnDelete.Text = resources.GetString("btnDelete.Text");
            this.btnDelete.TextAlign = ((System.Drawing.ContentAlignment)(resources.GetObject("btnDelete.TextAlign")));
            this.btnDelete.Visible = ((bool)(resources.GetObject("btnDelete.Visible")));
            this.btnDelete.Click += new System.EventHandler(this.btnDelete_Click);
            // 
            // MultiWOIssueMaterial
            // 
            this.AccessibleDescription = resources.GetString("$this.AccessibleDescription");
            this.AccessibleName = resources.GetString("$this.AccessibleName");
            this.AutoScaleBaseSize = ((System.Drawing.Size)(resources.GetObject("$this.AutoScaleBaseSize")));
            this.AutoScroll = ((bool)(resources.GetObject("$this.AutoScroll")));
            this.AutoScrollMargin = ((System.Drawing.Size)(resources.GetObject("$this.AutoScrollMargin")));
            this.AutoScrollMinSize = ((System.Drawing.Size)(resources.GetObject("$this.AutoScrollMinSize")));
            this.BackgroundImage = ((System.Drawing.Image)(resources.GetObject("$this.BackgroundImage")));
            this.CancelButton = this.btnClose;
            this.ClientSize = ((System.Drawing.Size)(resources.GetObject("$this.ClientSize")));
            this.Controls.Add(this.btnDelete);
            this.Controls.Add(this.dtmIssueDay);
            this.Controls.Add(this.lblIssueDay);
            this.Controls.Add(this.btnPrint);
            this.Controls.Add(this.btnPrintConfiguration);
            this.Controls.Add(this.btnShift);
            this.Controls.Add(this.lblShift);
            this.Controls.Add(this.txtShift);
            this.Controls.Add(this.txtToBin);
            this.Controls.Add(this.txtToLocation);
            this.Controls.Add(this.txtPurpose);
            this.Controls.Add(this.txtMasLoc);
            this.Controls.Add(this.dgrdData);
            this.Controls.Add(this.txtIssueNo);
            this.Controls.Add(this.btnToLocation);
            this.Controls.Add(this.btnToBin);
            this.Controls.Add(this.btnPurpose);
            this.Controls.Add(this.lblToBin);
            this.Controls.Add(this.lblToLocation);
            this.Controls.Add(this.lblPurpose);
            this.Controls.Add(this.dtmPostDate);
            this.Controls.Add(this.cboCCN);
            this.Controls.Add(this.btnFindMasLoc);
            this.Controls.Add(this.btnClose);
            this.Controls.Add(this.btnHelp);
            this.Controls.Add(this.btnSave);
            this.Controls.Add(this.btnAdd);
            this.Controls.Add(this.btnSelectWO);
            this.Controls.Add(this.lblCCN);
            this.Controls.Add(this.lblPostDate);
            this.Controls.Add(this.lblMasLoc);
            this.Controls.Add(this.lblIssueNo);
            this.Controls.Add(this.btnFindIssueNo);
            this.Controls.Add(this.lblFromBin);
            this.Controls.Add(this.lblFromLoc);
            this.Enabled = ((bool)(resources.GetObject("$this.Enabled")));
            this.Font = ((System.Drawing.Font)(resources.GetObject("$this.Font")));
            this.Icon = ((System.Drawing.Icon)(resources.GetObject("$this.Icon")));
            this.ImeMode = ((System.Windows.Forms.ImeMode)(resources.GetObject("$this.ImeMode")));
            this.KeyPreview = true;
            this.Location = ((System.Drawing.Point)(resources.GetObject("$this.Location")));
            this.MaximumSize = ((System.Drawing.Size)(resources.GetObject("$this.MaximumSize")));
            this.MinimumSize = ((System.Drawing.Size)(resources.GetObject("$this.MinimumSize")));
            this.Name = "MultiWOIssueMaterial";
            this.RightToLeft = ((System.Windows.Forms.RightToLeft)(resources.GetObject("$this.RightToLeft")));
            this.StartPosition = ((System.Windows.Forms.FormStartPosition)(resources.GetObject("$this.StartPosition")));
            this.Text = resources.GetString("$this.Text");
            this.KeyDown += new System.Windows.Forms.KeyEventHandler(this.MultiWOIssueMaterial_KeyDown);
            this.Closing += new System.ComponentModel.CancelEventHandler(this.MultiWOIssueMaterial_Closing);
            this.Load += new System.EventHandler(this.MultiWOIssueMaterial_Load);
            ((System.ComponentModel.ISupportInitialize)(this.dgrdData)).EndInit();
            ((System.ComponentModel.ISupportInitialize)(this.cboCCN)).EndInit();
            ((System.ComponentModel.ISupportInitialize)(this.dtmPostDate)).EndInit();
            ((System.ComponentModel.ISupportInitialize)(this.dtmIssueDay)).EndInit();
            this.ResumeLayout(false);

        }

        #endregion

        #region Properties
        public EnumAction FormMode
        {
            get { return mFormMode; }
            set { mFormMode = value; }
        }

        #endregion Properties

        #region Build & Show Reports: Added by Tuan TQ

        /// <summary>
        /// Build and show Issuance Slip Report
        /// </summary>
        /// <Author> Tuan TQ, 05 Dec, 2005</Author>
        protected void ShowIssuanceSlipReport(object sender, System.EventArgs e)
        {

            const string METHOD_NAME = THIS + ".ShowIssuanceSlipReport()";
            try
            {

                const string MAX_ROWS = "40";
                const int ROWS_PER_PAGE = 40;

                const string APPLICATION_PATH = @"PCSMain\bin\Debug";

                const string REPORTFLD_COMPANY = "fldCompany";
                const string ROW_INDEX_FLD = "RowIndex";
                const string ISSUANCE_SLIP_REPORT = "IssuanceSlipReport.xml";

                //un-used data column name
                const string SUB_ITEM_CODE_FLD = "SubItem_Code";
                const string SUB_ITEM_MODEL_FLD = "SubItem_Model";
                const string SUB_ITEM_NAME_FLD = "SubItem_Name";
                const string PLANNED_QTY_FLD = "PlannedQty";
                const string COMMIT_QTY_FLD = "CommitQuantity";
                const string STOCKUM_FLD = "StockUM";
                const string VENDOR_FLD = "Vendor";

                //return if no record was selected
                if (issueMaterialMaster.IssueMaterialMasterID <= 0)
                {
                    return;
                }

                //Change cursor to wait status
                this.Cursor = Cursors.WaitCursor;

                C1PrintPreviewDialog printPreview = new C1PrintPreviewDialog();
                C1PrintPreviewDialogBO boDataReport = new C1PrintPreviewDialogBO();

                DataTable dtbResult;
                dtbResult = boDataReport.GetIssuanceSlipData(issueMaterialMaster.IssueMaterialMasterID, MAX_ROWS);

                // Check data source
                if (dtbResult != null)
                {
                    for (int i = 0; i < dtbResult.Rows.Count; i++)
                    {
                        dtbResult.Rows[i][ROW_INDEX_FLD] = i + 1;
                    }

                    //Prepare data for blank row
                    DataRow drowSourceBlankRow = dtbResult.NewRow();
                    if (dtbResult.Rows.Count > 0)
                    {
                        //Copy data
                        for (int colIndex = 0; colIndex < dtbResult.Columns.Count; colIndex++)
                        {
                            drowSourceBlankRow[colIndex] = dtbResult.Rows[0][colIndex];
                        }

                        //Clear value of un-used column
                        drowSourceBlankRow[ROW_INDEX_FLD] = DBNull.Value;
                        drowSourceBlankRow[SUB_ITEM_CODE_FLD] = DBNull.Value;
                        drowSourceBlankRow[SUB_ITEM_MODEL_FLD] = DBNull.Value;
                        drowSourceBlankRow[SUB_ITEM_NAME_FLD] = DBNull.Value;
                        drowSourceBlankRow[PLANNED_QTY_FLD] = DBNull.Value;
                        drowSourceBlankRow[COMMIT_QTY_FLD] = DBNull.Value;
                        drowSourceBlankRow[VENDOR_FLD] = DBNull.Value;
                        drowSourceBlankRow[STOCKUM_FLD] = DBNull.Value;
                    }

                    //Append blank rows to enough MAX_ROWS
                    int intTotalLackRows = ROWS_PER_PAGE - dtbResult.Rows.Count % ROWS_PER_PAGE;
                    for (int i = 1; i <= intTotalLackRows; i++)
                    {
                        //Create new blank row
                        DataRow drowBlank = dtbResult.NewRow();

                        //Copy data
                        for (int colIndex = 0; colIndex < dtbResult.Columns.Count; colIndex++)
                        {
                            drowBlank[colIndex] = drowSourceBlankRow[colIndex];
                        }

                        dtbResult.Rows.Add(drowBlank);
                    }
                }

                ReportBuilder reportBuilder = new ReportBuilder();

                //Get actual application path
                string strReportPath = Application.StartupPath;
                int intIndex = strReportPath.IndexOf(APPLICATION_PATH);
                if (intIndex > -1)
                {
                    strReportPath = strReportPath.Substring(0, intIndex);
                }

                if (strReportPath.Substring(strReportPath.Length - 1) == @"\")
                {
                    strReportPath += Constants.REPORT_DEFINITION_STORE_LOCATION;
                }
                else
                {
                    strReportPath += "\\" + Constants.REPORT_DEFINITION_STORE_LOCATION;
                }

                //Set datasource and lay-out path for reports
                reportBuilder.SourceDataTable = dtbResult;
                reportBuilder.ReportDefinitionFolder = strReportPath;

                reportBuilder.ReportLayoutFile = ISSUANCE_SLIP_REPORT;

                //check if layout is valid
                if (reportBuilder.AnalyseLayoutFile())
                {
                    reportBuilder.UseLayoutFile = true;
                }
                else
                {
                    //Change cursor to default status
                    this.Cursor = Cursors.Default;

                    PCSMessageBox.Show(ErrorCode.MESSAGE_REPORT_TEMPLATE_FILE_NOT_FOUND, MessageBoxIcon.Error);
                    return;
                }

                reportBuilder.MakeDataTableForRender();

                // and show it in preview dialog				
                reportBuilder.ReportViewer = printPreview.ReportViewer;
                reportBuilder.RenderReport();

                //Header information get from system params				
                reportBuilder.DrawPredefinedField(REPORTFLD_COMPANY, SystemProperty.SytemParams.Get(SystemParam.COMPANY_FULL_NAME));

                reportBuilder.RefreshReport();

                //Print report
                try
                {
                    printPreview.FormTitle = reportBuilder.GetFieldByName(REPORTFLD_TITLE).Text;
                }
                catch { }
                printPreview.Show();
            }
            catch (PCSException ex)
            {
                // displays the error message.
                PCSMessageBox.Show(ex.mCode, MessageBoxIcon.Error);
                // log message.
                try
                {
                    Logger.LogMessage(ex.CauseException, METHOD_NAME, Level.ERROR);
                }
                catch
                {
                    PCSMessageBox.Show(ErrorCode.LOG_EXCEPTION, MessageBoxIcon.Error);
                }
            }
            catch (Exception ex)
            {
                // displays the error message.
                PCSMessageBox.Show(ErrorCode.OTHER_ERROR, MessageBoxButtons.OK, MessageBoxIcon.Error);
                // log message.
                try
                {
                    Logger.LogMessage(ex, METHOD_NAME, Level.ERROR);
                }
                catch
                {
                    PCSMessageBox.Show(ErrorCode.LOG_EXCEPTION, MessageBoxButtons.OK, MessageBoxIcon.Error);
                }
            }
            finally
            {
                //Change cursor to default status
                this.Cursor = Cursors.Default;
            }
        }


        /// <summary>
        /// Build and show Other Issuance Slip Report
        /// </summary>
        /// <Author> Tuan TQ, 02 Dec, 2005</Author>
        protected void ShowOtherIssuanceSlipReport(object sender, System.EventArgs e)
        {
            const string METHOD_NAME = THIS + ".ShowOtherIssuanceSlipReport()";
            try
            {
                const string MAX_ROWS = "40";
                const int ROWS_PER_PAGE = 40;

                const string APPLICATION_PATH = @"PCSMain\bin\Debug";
                const string REPORTFLD_COMPANY = "fldCompany";
                const string ROW_INDEX_FLD = "RowIndex";
                const string DELIVERY_TO_NEXT_SLIP_REPORT = "OtherIssuanceSlipReport.xml";

                //un-used data column name
                const string SUB_ITEM_CODE_FLD = "SubItem_Code";
                const string SUB_ITEM_MODEL_FLD = "SubItem_Model";
                const string SUB_ITEM_NAME_FLD = "SubItem_Name";
                const string COMMIT_QTY_FLD = "CommitQuantity";
                const string STOCKUM_FLD = "StockUM";
                const string CATEGORY_FLD = "Category";
                const string VENDOR_FLD = "Vendor";

                //return if no record was selected
                if (issueMaterialMaster.IssueMaterialMasterID <= 0)
                {
                    return;
                }

                //Change cursor to wait status
                this.Cursor = Cursors.WaitCursor;

                C1PrintPreviewDialog printPreview = new C1PrintPreviewDialog();
                C1PrintPreviewDialogBO boDataReport = new C1PrintPreviewDialogBO();

                DataTable dtbResult;
                dtbResult = boDataReport.GetOtherIssuanceSlipData(issueMaterialMaster.IssueMaterialMasterID, MAX_ROWS);

                // Check data source
                if (dtbResult != null)
                {
                    for (int i = 0; i < dtbResult.Rows.Count; i++)
                    {
                        dtbResult.Rows[i][ROW_INDEX_FLD] = i + 1;
                    }

                    //Prepare data for blank row
                    DataRow drowSourceBlankRow = dtbResult.NewRow();
                    if (dtbResult.Rows.Count > 0)
                    {
                        //Copy data
                        for (int colIndex = 0; colIndex < dtbResult.Columns.Count; colIndex++)
                        {
                            drowSourceBlankRow[colIndex] = dtbResult.Rows[0][colIndex];
                        }

                        //Clear value of un-used column
                        drowSourceBlankRow[ROW_INDEX_FLD] = DBNull.Value;
                        drowSourceBlankRow[SUB_ITEM_CODE_FLD] = DBNull.Value;
                        drowSourceBlankRow[SUB_ITEM_MODEL_FLD] = DBNull.Value;
                        drowSourceBlankRow[SUB_ITEM_NAME_FLD] = DBNull.Value;
                        drowSourceBlankRow[COMMIT_QTY_FLD] = DBNull.Value;
                        drowSourceBlankRow[CATEGORY_FLD] = DBNull.Value;
                        drowSourceBlankRow[STOCKUM_FLD] = DBNull.Value;
                        drowSourceBlankRow[VENDOR_FLD] = DBNull.Value;
                    }

                    //Append blank rows to enough MAX_ROWS
                    int intTotalLackRows = ROWS_PER_PAGE - dtbResult.Rows.Count % ROWS_PER_PAGE;
                    for (int i = 1; i <= intTotalLackRows; i++)
                    {
                        //Create new blank row
                        DataRow drowBlank = dtbResult.NewRow();

                        //Copy data
                        for (int colIndex = 0; colIndex < dtbResult.Columns.Count; colIndex++)
                        {
                            drowBlank[colIndex] = drowSourceBlankRow[colIndex];
                        }

                        dtbResult.Rows.Add(drowBlank);
                    }
                }

                ReportBuilder reportBuilder = new ReportBuilder();

                //Get actual application path
                string strReportPath = Application.StartupPath;
                int intIndex = strReportPath.IndexOf(APPLICATION_PATH);
                if (intIndex > -1)
                {
                    strReportPath = strReportPath.Substring(0, intIndex);
                }

                if (strReportPath.Substring(strReportPath.Length - 1) == @"\")
                {
                    strReportPath += Constants.REPORT_DEFINITION_STORE_LOCATION;
                }
                else
                {
                    strReportPath += "\\" + Constants.REPORT_DEFINITION_STORE_LOCATION;
                }

                //Set datasource and lay-out path for reports
                reportBuilder.SourceDataTable = dtbResult;
                reportBuilder.ReportDefinitionFolder = strReportPath;

                reportBuilder.ReportLayoutFile = DELIVERY_TO_NEXT_SLIP_REPORT;

                //check if layout is valid
                if (reportBuilder.AnalyseLayoutFile())
                {
                    reportBuilder.UseLayoutFile = true;
                }
                else
                {
                    //Change cursor to default status
                    this.Cursor = Cursors.Default;

                    PCSMessageBox.Show(ErrorCode.MESSAGE_REPORT_TEMPLATE_FILE_NOT_FOUND, MessageBoxIcon.Error);
                    return;
                }

                reportBuilder.MakeDataTableForRender();

                // and show it in preview dialog				
                reportBuilder.ReportViewer = printPreview.ReportViewer;
                reportBuilder.RenderReport();

                //Header information get from system params				
                reportBuilder.DrawPredefinedField(REPORTFLD_COMPANY, SystemProperty.SytemParams.Get(SystemParam.COMPANY_FULL_NAME));

                reportBuilder.RefreshReport();

                //Print report
                try
                {
                    printPreview.FormTitle = reportBuilder.GetFieldByName(REPORTFLD_TITLE).Text;
                }
                catch { }
                printPreview.Show();
            }
            catch (PCSException ex)
            {
                // displays the error message.
                PCSMessageBox.Show(ex.mCode, MessageBoxIcon.Error);
                // log message.
                try
                {
                    Logger.LogMessage(ex.CauseException, METHOD_NAME, Level.ERROR);
                }
                catch
                {
                    PCSMessageBox.Show(ErrorCode.LOG_EXCEPTION, MessageBoxIcon.Error);
                }
            }
            catch (Exception ex)
            {
                // displays the error message.
                PCSMessageBox.Show(ErrorCode.OTHER_ERROR, MessageBoxButtons.OK, MessageBoxIcon.Error);
                // log message.
                try
                {
                    Logger.LogMessage(ex, METHOD_NAME, Level.ERROR);
                }
                catch
                {
                    PCSMessageBox.Show(ErrorCode.LOG_EXCEPTION, MessageBoxButtons.OK, MessageBoxIcon.Error);
                }
            }
            finally
            {
                //Change cursor to default status
                this.Cursor = Cursors.Default;
            }
        }

        /// <summary>
        /// Build and show Delivery To Next Slip Report
        /// </summary>
        /// <Author> Tuan TQ, 01 Dec, 2005</Author>
        protected void ShowDelivery2NextSlipReport(object sender, System.EventArgs e)
        {
            const string METHOD_NAME = THIS + ".ShowDelivery2NextSlipReport()";
            try
            {
                const string MAX_ROWS = " 100 PERCENT ";
                const int ROWS_PER_PAGE = 34;

                const string APPLICATION_PATH = @"PCSMain\bin\Debug";
                const string REPORTFLD_COMPANY = "fldCompany";
                const string ROW_INDEX_FLD = "RowIndex";
                const string DELIVERY_TO_NEXT_SLIP_REPORT = "Delivery2NextStageSlipReport.xml";

                //un-used data column name
                const string SUB_ITEM_CODE_FLD = "SubItem_Code";
                const string SUB_ITEM_MODEL_FLD = "SubItem_Model";
                const string SUB_ITEM_NAME_FLD = "SubItem_Name";
                const string PLANNED_QTY_FLD = "PlannedQty";
                const string COMMIT_QTY_FLD = "CommitQuantity";
                const string STOCKUM_FLD = "StockUM";
                const string CATEGORY_FLD = "Category";

                //return if no record was selected
                if (issueMaterialMaster.IssueMaterialMasterID <= 0)
                {
                    return;
                }

                //Change cursor to wait status
                this.Cursor = Cursors.WaitCursor;

                C1PrintPreviewDialog printPreview = new C1PrintPreviewDialog();
                C1PrintPreviewDialogBO boDataReport = new C1PrintPreviewDialogBO();

                DataTable dtbResult;
                dtbResult = boDataReport.GetDelivery2NextSlipData(issueMaterialMaster.IssueMaterialMasterID, MAX_ROWS);

                // Check data source
                if (dtbResult != null)
                {
                    for (int i = 0; i < dtbResult.Rows.Count; i++)
                    {
                        dtbResult.Rows[i][ROW_INDEX_FLD] = i + 1;
                    }

                    //Prepare data for blank row
                    DataRow drowSourceBlankRow = dtbResult.NewRow();
                    if (dtbResult.Rows.Count > 0)
                    {
                        //Copy data
                        for (int colIndex = 0; colIndex < dtbResult.Columns.Count; colIndex++)
                        {
                            drowSourceBlankRow[colIndex] = dtbResult.Rows[0][colIndex];
                        }

                        //Clear value of un-used column
                        drowSourceBlankRow[ROW_INDEX_FLD] = DBNull.Value;
                        drowSourceBlankRow[SUB_ITEM_CODE_FLD] = DBNull.Value;
                        drowSourceBlankRow[SUB_ITEM_MODEL_FLD] = DBNull.Value;
                        drowSourceBlankRow[SUB_ITEM_NAME_FLD] = DBNull.Value;
                        drowSourceBlankRow[PLANNED_QTY_FLD] = DBNull.Value;
                        drowSourceBlankRow[COMMIT_QTY_FLD] = DBNull.Value;
                        drowSourceBlankRow[CATEGORY_FLD] = DBNull.Value;
                        drowSourceBlankRow[STOCKUM_FLD] = DBNull.Value;
                    }

                    //Append blank rows to enough MAX_ROWS
                    int intTotalLackRows = ROWS_PER_PAGE - dtbResult.Rows.Count % ROWS_PER_PAGE;
                    for (int i = 1; i <= intTotalLackRows; i++)
                    {
                        //Create new blank row
                        DataRow drowBlank = dtbResult.NewRow();

                        //Copy data
                        for (int colIndex = 0; colIndex < dtbResult.Columns.Count; colIndex++)
                        {
                            drowBlank[colIndex] = drowSourceBlankRow[colIndex];
                        }

                        dtbResult.Rows.Add(drowBlank);
                    }
                }

                ReportBuilder reportBuilder = new ReportBuilder();

                //Get actual application path
                string strReportPath = Application.StartupPath;
                int intIndex = strReportPath.IndexOf(APPLICATION_PATH);
                if (intIndex > -1)
                {
                    strReportPath = strReportPath.Substring(0, intIndex);
                }

                if (strReportPath.Substring(strReportPath.Length - 1) == @"\")
                {
                    strReportPath += Constants.REPORT_DEFINITION_STORE_LOCATION;
                }
                else
                {
                    strReportPath += "\\" + Constants.REPORT_DEFINITION_STORE_LOCATION;
                }

                //Set datasource and lay-out path for reports
                reportBuilder.SourceDataTable = dtbResult;
                reportBuilder.ReportDefinitionFolder = strReportPath;

                reportBuilder.ReportLayoutFile = DELIVERY_TO_NEXT_SLIP_REPORT;

                //check if layout is valid
                if (reportBuilder.AnalyseLayoutFile())
                {
                    reportBuilder.UseLayoutFile = true;
                }
                else
                {
                    //Reset cursor
                    this.Cursor = Cursors.Default;
                    PCSMessageBox.Show(ErrorCode.MESSAGE_REPORT_TEMPLATE_FILE_NOT_FOUND, MessageBoxIcon.Error);
                    return;
                }

                reportBuilder.MakeDataTableForRender();

                // and show it in preview dialog				
                reportBuilder.ReportViewer = printPreview.ReportViewer;
                reportBuilder.RenderReport();

                //Header information get from system params				
                reportBuilder.DrawPredefinedField(REPORTFLD_COMPANY, SystemProperty.SytemParams.Get(SystemParam.COMPANY_FULL_NAME));

                reportBuilder.RefreshReport();

                //Print report
                try
                {
                    printPreview.FormTitle = reportBuilder.GetFieldByName(REPORTFLD_TITLE).Text;
                }
                catch { }
                printPreview.Show();

                #region display receive from previous production line slip - dungla 13-03-2006

                C1Report rptReceive = new C1Report();
                rptReceive.CopyFrom(reportBuilder.Report);
                // change the title
                try
                {
                    rptReceive.Fields["fldTitle"].Text = rptReceive.Fields["fldTitleReceive"].Text;
                    rptReceive.Fields["fldTitleVN"].Text = rptReceive.Fields["fldTitleReceiveVN"].Text;
                }
                catch { }
                // render report
                rptReceive.Render();
                // displays report
                C1PrintPreviewDialog dlgPreview = new C1PrintPreviewDialog();
                dlgPreview.ReportViewer.NavigationPanelVisible = false;
                dlgPreview.ReportViewer.Document = rptReceive.Document;
                dlgPreview.FormTitle = this.Text;
                dlgPreview.Show();

                #endregion
            }
            catch (PCSException ex)
            {
                // displays the error message.
                PCSMessageBox.Show(ex.mCode, MessageBoxIcon.Error);
                // log message.
                try
                {
                    Logger.LogMessage(ex.CauseException, METHOD_NAME, Level.ERROR);
                }
                catch
                {
                    PCSMessageBox.Show(ErrorCode.LOG_EXCEPTION, MessageBoxIcon.Error);
                }
            }
            catch (Exception ex)
            {
                // displays the error message.
                PCSMessageBox.Show(ErrorCode.OTHER_ERROR, MessageBoxButtons.OK, MessageBoxIcon.Error);
                // log message.
                try
                {
                    Logger.LogMessage(ex, METHOD_NAME, Level.ERROR);
                }
                catch
                {
                    PCSMessageBox.Show(ErrorCode.LOG_EXCEPTION, MessageBoxButtons.OK, MessageBoxIcon.Error);
                }
            }
            finally
            {
                //reset cursor
                this.Cursor = Cursors.Default;
            }
        }

        #endregion Issuance Report: Added by Tuan TQ

        #region Methods

        private void CalculateAssociatedQuantity(int pintCCNID, int pintMasterLocationID, bool blnCalulateCommitQty, DataTable pdtbData)
        {
            if (pdtbData.Rows.Count == 0)
            {
                return;
            }

            MultiWOIssueMaterialBO boMultiWOIssueMaterialBO = new MultiWOIssueMaterialBO();

            var productList = pdtbData.Rows.Cast<DataRow>().Where(drRow => drRow.RowState != DataRowState.Deleted).Select(
                row => Convert.ToInt32(row[ITM_ProductTable.PRODUCTID_FLD])).Distinct().ToList();
            
            var dtbAvailableQuantity = boMultiWOIssueMaterialBO.GetAvailableQuantity(pintCCNID, pintMasterLocationID, productList);
            var dtbCommitedQuantity = boMultiWOIssueMaterialBO.GetCommitedQuantity(pintMasterLocationID, productList);

            decimal remainNeededQty = decimal.Zero;

            foreach (DataRow drRow in pdtbData.Rows.Cast<DataRow>().Where(drRow => drRow.RowState != DataRowState.Deleted))
            {
                //get Product
                var productId = Convert.ToInt32(drRow[ITM_ProductTable.PRODUCTID_FLD]);
                int binId = 0;
                int locationId = 0;
                if (drRow[MST_BINTable.BINID_FLD] != DBNull.Value && !string.IsNullOrEmpty(drRow[MST_BINTable.BINID_FLD].ToString()))
                {
                    binId = Convert.ToInt32(drRow[MST_BINTable.BINID_FLD]);
                }

                if (drRow[MST_LocationTable.LOCATIONID_FLD] != DBNull.Value && !string.IsNullOrEmpty(drRow[MST_LocationTable.LOCATIONID_FLD].ToString()))
                {
                    locationId = Convert.ToInt32(drRow[MST_LocationTable.LOCATIONID_FLD]);
                }

                var availableQty = dtbAvailableQuantity.Where(b => b.LocationID == locationId && b.BinID == binId && b.ProductID == productId).Sum(b => b.OHQuantity - b.CommitQuantity.GetValueOrDefault(0));
                drRow[Constants.AVAILABLE_QTY_COL] = availableQty.GetValueOrDefault(0);

                int workOrderDetailId = Convert.ToInt32(drRow[PRO_IssueMaterialDetailTable.WORKORDERDETAILID_FLD]);

                var decCommitedQty = dtbCommitedQuantity.Where(c => c.WorkOrderDetailID == workOrderDetailId && c.ProductID == productId).Sum(c => c.CommitQuantity);
                drRow[Constants.COMMITED_QTY_COL] = decCommitedQty;
                
                if (drRow[Constants.RemainNeededQuantity_COL] != null)
                {
                    if (!decimal.TryParse(drRow[Constants.RemainNeededQuantity_COL].ToString(), out remainNeededQty))
                    {
                        remainNeededQty = 0;
                    }
                }

                //calculate the Commit Quantity for this product
                decimal decCommitQty = remainNeededQty - decCommitedQty;

                drRow[PRO_IssueMaterialDetailTable.COMMITQUANTITY_FLD] = decCommitQty < 0 ? 0 : decCommitQty;
            }
        }

        /// <summary>
        /// Load the data into the grid
        /// and then customize the interface for the grid
        /// Turn some columns to have button to open search form
        /// </summary>
        private void DisplayDetailData()
        {
            dgrdData.DataSource = dstData.Tables[0];

            //restore the layout of the grid
            FormControlComponents.RestoreGridLayout(dgrdData, dtStoreGridLayout);

            //align right for Line, Delivery Quantity, Delivery No
            dgrdData.Splits[0].DisplayColumns[PRO_IssueMaterialDetailTable.COMMITQUANTITY_FLD].Style.HorizontalAlignment = AlignHorzEnum.Far;

            //Set the Delivery Quantity
            dgrdData.Splits[0].DisplayColumns[HASBIN].Visible = false;
            dgrdData.Splits[0].DisplayColumns[Constants.RemainNeededQuantity_COL].Visible = false;
            dgrdData.Splits[0].DisplayColumns[ITM_ProductTable.LOTCONTROL_FLD].Visible = false;
            //change some columns to have search button

            dgrdData.Splits[0].DisplayColumns[LOCATIONCODE_COL].Button = true;
            dgrdData.Splits[0].DisplayColumns[BINCODE_COL].Button = true;

            //dgrdData.Splits[0].DisplayColumns[UNITCODE_COL].Button = true;
            dgrdData.Splits[0].DisplayColumns[PRO_IssueMaterialDetailTable.LOT_FLD].Button = true;

            //align the number column
            dgrdData.Splits[0].DisplayColumns[PRO_IssueMaterialDetailTable.LINE_FLD].Style.HorizontalAlignment = AlignHorzEnum.Far;
            dgrdData.Splits[0].DisplayColumns[PRO_IssueMaterialDetailTable.COMMITQUANTITY_FLD].Style.HorizontalAlignment = AlignHorzEnum.Far;
            dgrdData.Splits[0].DisplayColumns[Constants.AVAILABLE_QTY_COL].Style.HorizontalAlignment = AlignHorzEnum.Far;
            dgrdData.Splits[0].DisplayColumns[Constants.COMMITED_QTY_COL].Style.HorizontalAlignment = AlignHorzEnum.Far;
            dgrdData.Splits[0].DisplayColumns[Constants.NEEDED_QTY_COL].Style.HorizontalAlignment = AlignHorzEnum.Far;
            dgrdData.Splits[0].DisplayColumns[PRO_IssueMaterialDetailTable.BOMQUANTITY_FLD].Style.HorizontalAlignment = AlignHorzEnum.Far;

            //Set the number format for the number column
            dgrdData.Columns[PRO_IssueMaterialDetailTable.COMMITQUANTITY_FLD].NumberFormat = Constants.DECIMAL_LONG_FORMAT;
            dgrdData.Columns[Constants.AVAILABLE_QTY_COL].NumberFormat = Constants.DECIMAL_LONG_FORMAT;
            dgrdData.Columns[Constants.COMMITED_QTY_COL].NumberFormat = Constants.DECIMAL_LONG_FORMAT;
            dgrdData.Columns[Constants.NEEDED_QTY_COL].NumberFormat = Constants.DECIMAL_LONG_FORMAT;
            dgrdData.Columns[PRO_IssueMaterialDetailTable.BOMQUANTITY_FLD].NumberFormat = Constants.DECIMAL_LONG_FORMAT;

            dgrdData.Columns[PRO_IssueMaterialDetailTable.QASTATUS_FLD].ValueItems.Presentation = PresentationEnum.ComboBox;
            dgrdData.Columns[PRO_IssueMaterialDetailTable.QASTATUS_FLD].ValueItems.Translate = true;
            dgrdData.Columns[PRO_IssueMaterialDetailTable.QASTATUS_FLD].ValueItems.Validate = true;

            //lock several column
            dgrdData.Splits[0].DisplayColumns[SO_SaleOrderDetailTable.FGOODSCODE_FLD].Locked = true;

            dgrdData.Splits[0].DisplayColumns[Constants.AVAILABLE_QTY_COL].Locked = true;
            dgrdData.Splits[0].DisplayColumns[Constants.COMMITED_QTY_COL].Locked = true;
            dgrdData.Splits[0].DisplayColumns[Constants.NEEDED_QTY_COL].Locked = true;
            dgrdData.Splits[0].DisplayColumns[UNITCODE_COL].Locked = true;
            dgrdData.Splits[0].DisplayColumns[PRO_IssueMaterialDetailTable.QASTATUS_FLD].Locked = true;
            dgrdData.Splits[0].DisplayColumns[PRO_IssueMaterialDetailTable.LINE_FLD].Locked = true;
            dgrdData.Splits[0].DisplayColumns[PRO_WorkOrderMasterTable.TABLE_NAME + PRO_WorkOrderMasterTable.WORKORDERNO_FLD].Locked = true;
            dgrdData.Splits[0].DisplayColumns[PRO_WorkOrderDetailTable.TABLE_NAME + PRO_WorkOrderDetailTable.LINE_FLD].Locked = true;
            dgrdData.Splits[0].DisplayColumns[ITM_ProductTable.TABLE_NAME + ITM_ProductTable.CODE_FLD].Locked = true;
            dgrdData.Splits[0].DisplayColumns[ITM_ProductTable.TABLE_NAME + ITM_ProductTable.DESCRIPTION_FLD].Locked = true;
            dgrdData.Splits[0].DisplayColumns[ITM_ProductTable.TABLE_NAME + ITM_ProductTable.REVISION_FLD].Locked = true;

            //HACK: added by Tuan TQ 23 May, 2006
            dgrdData.Splits[0].DisplayColumns[ITM_CategoryTable.TABLE_NAME + ITM_CategoryTable.CODE_FLD].Locked = true;
            dgrdData.Splits[0].DisplayColumns[MST_PartyTable.TABLE_NAME + MST_PartyTable.CODE_FLD].Locked = true;
            dgrdData.Splits[0].DisplayColumns[MST_PartyTable.TABLE_NAME + MST_PartyTable.NAME_FLD].Locked = true;
            dgrdData.Splits[0].DisplayColumns[PRO_IssueMaterialDetailTable.BOMQUANTITY_FLD].Locked = true;
            //End hack
        }

        /// <summary>
        /// This method is used to display the detail data into the grid
        /// First it will get the data from database
        /// Restore the grid layout
        /// Set the column layout, format , and load default data into grid
        /// </summary>
        /// <param name="pintMasterID"></param>		
        private void LoadDetailData(DateTime pdtmPostDate, int pintMasterID, int pintCCNID, int pintMasterLocationID)
        {
            MultiWOIssueMaterialBO boMultiWOIssueMaterialBO = new MultiWOIssueMaterialBO();
            //Get the detail data
            dstData = boMultiWOIssueMaterialBO.GetDetailData(pdtmPostDate, pintMasterID, pintCCNID, pintMasterLocationID);
            dstData.Tables[0].Columns.Add(HASBIN);
            dstData.Tables[0].Columns.Add(ITM_ProductTable.LOTCONTROL_FLD);

            //after get the detail data, will display it
            DisplayDetailData();
        }

        /// <summary>
        /// This method is used to lock the controls on form
        /// Based on the parameter input 
        /// </summary>
        /// <param name="blnLock"></param>
        private void LockForm(bool blnLock)
        {
            dtmPostDate.ReadOnly = blnLock;
            cboCCN.ReadOnly = blnLock;
            btnFindIssueNo.Enabled = !blnLock;

            txtMasLoc.ReadOnly = blnLock;
            btnFindMasLoc.Enabled = !blnLock;

            //dgrdData.AllowAddNew = !blnLock;
            dgrdData.AllowUpdate = !blnLock;
            dgrdData.AllowDelete = !blnLock;
        }

        /// <summary>
        /// This method is used to enable or disable all button on form
        /// based on the current Form Mode
        /// For the Default mode, we have to consider the right for each button on form
        /// to enable or disable that button
        /// </summary>
        private void EnableDisableButtons()
        {
            switch (mFormMode)
            {
                case EnumAction.Add:
                    txtIssueNo.ReadOnly = true;
                    btnFindIssueNo.Enabled = false;
                    //Disable Buttons
                    btnAdd.Enabled = false;
                    btnPrintConfiguration.Enabled = btnPrint.Enabled = false;
                    btnSave.Enabled = true;
                    btnSelectWO.Enabled = true;
                    // HACK: Trada 27-10-2005
                    txtPurpose.Enabled = true;
                    txtToLocation.Enabled = true;
                    btnToLocation.Enabled = true;
                    btnPurpose.Enabled = true;
                    txtShift.Enabled = true;
                    btnShift.Enabled = true;
                    // END: Trada 27-10-2005
                    break;
                case EnumAction.Edit:
                    txtIssueNo.ReadOnly = true;
                    btnFindIssueNo.Enabled = false;
                    //Disable Buttons
                    btnAdd.Enabled = false;
                    btnPrintConfiguration.Enabled = btnPrint.Enabled = false;
                    btnSave.Enabled = true;
                    btnSelectWO.Enabled = true;
                    // HACK: Trada 27-10-2005
                    txtPurpose.Enabled = true;
                    txtToLocation.Enabled = true;
                    btnToLocation.Enabled = true;
                    btnPurpose.Enabled = true;
                    txtShift.Enabled = true;
                    btnShift.Enabled = true;
                    // END: Trada 27-10-2005
                    break;
                case EnumAction.Default:

                    txtIssueNo.ReadOnly = false;
                    btnFindIssueNo.Enabled = true;
                    //Disable Buttons
                    btnSave.Enabled = false;
                    btnSelectWO.Enabled = false;
                    btnPrintConfiguration.Enabled = btnPrint.Enabled = (txtIssueNo.Text.Trim() != string.Empty);
                    // HACK: Trada 27-10-2005
                    txtPurpose.Enabled = false;
                    txtToLocation.Enabled = false;
                    btnToLocation.Enabled = false;
                    txtToBin.Enabled = false;
                    btnToBin.Enabled = false;
                    btnPurpose.Enabled = false;
                    txtShift.Enabled = false;
                    btnShift.Enabled = false;
                    // END: Trada 27-10-2005

                    btnAdd.Enabled = true;
                    break;
            }
        }

        /// <summary>
        /// This method is used to clear all data on form
        /// 
        /// </summary>
        private void ClearForm()
        {
            const string METHOD_NAME = THIS + ".ClearForm()";
            try
            {
                //general information
                dtmPostDate.Value = DBNull.Value;
                dtmIssueDay.Value = DBNull.Value;
                txtIssueNo.Text = string.Empty;

                #region HACK: DEL Trada 10-18-2005

                //				cboCCN.Text = string.Empty;
                //				cboCCN.SelectedIndex = -1;

                #endregion END: DEL Trada 10-18-2005

                txtMasLoc.Text = string.Empty;
                // HACK: Trada 10-26-2005
                txtPurpose.Text = string.Empty;
                txtToLocation.Text = string.Empty;
                txtToBin.Text = string.Empty;
                txtShift.Text = string.Empty;
                // END: Trada 10-26-2005

                //clear data in the grid
                if (dstData != null && dstData.Tables.Count > 0)
                    dstData.Tables[0].Rows.Clear();
                //dgrdData.DataSource = null;
                //dgrdData.Refresh();

                // reset variable
                strLastValidPurpose = string.Empty;
                strLastValidShift = string.Empty;
                strLastValidMasLoc = string.Empty;
                strLastValidLocation = string.Empty;
                strLastValidBin = string.Empty;
            }
            catch (Exception ex)
            {
                // displays the error message.
                PCSMessageBox.Show(ErrorCode.OTHER_ERROR, MessageBoxIcon.Error);
                // log message.
                try
                {
                    Logger.LogMessage(ex, METHOD_NAME, Level.ERROR);
                }
                catch
                {
                    PCSMessageBox.Show(ErrorCode.LOG_EXCEPTION, MessageBoxIcon.Error);
                }
            }
        }

        /// <summary>
        /// After deleting each row in the grid,
        /// we need to reset its line number
        /// </summary>
        private void ChangeLineNumber()
        {
            try
            {
                int intGridRows = this.dgrdData.RowCount;

                int i;
                for (i = 0; i < intGridRows; i++)
                {
                    dgrdData[i, PRO_IssueMaterialDetailTable.LINE_FLD] = i + 1;

                }
            }
            catch (Exception ex)
            {
                throw new Exception(ex.Message, ex);
            }

        }

        /// <summary>
        /// this method is used to get the max line number for the grid
        /// </summary>
        /// <returns></returns>
        private int GetTheNextLineNumber()
        {
            const string METHOD_NAME = THIS + ".GetTheNextLineNumber()";
            try
            {
                int intGridRows = this.dgrdData.RowCount;

                if (intGridRows == 0)
                {
                    return 1;
                }
                int intMax = 0;
                for (int i = 0; i < intGridRows; i++)
                {
                    int intTmp;
                    try
                    {
                        intTmp = int.Parse(this.dgrdData[i, PRO_IssueMaterialDetailTable.LINE_FLD].ToString());
                    }
                    catch
                    {
                        intTmp = 0;
                    }
                    if (intMax < intTmp)
                    {
                        intMax = intTmp;
                    }
                }
                return intMax + 1;
            }
            catch (Exception ex)
            {
                throw new Exception(ex.Message, ex);
            }

        }

        /// <summary>
        /// Validate all the manadatory fields on form
        /// </summary>
        /// <returns></returns>
        private bool ValidateMandatoryControl()
        {
            try
            {
                if (issueMaterialMaster.MasterLocationID <= 0)
                {
                    //MessageBox.Show("Please select the master location");
                    PCSMessageBox.Show(ErrorCode.MSG_LABORTIME_SELECTMASLOC, MessageBoxIcon.Warning);
                    //btnSearchMasterLocation.Focus();
                    txtMasLoc.Focus();
                    return false;
                }

                if (cboCCN.SelectedIndex < 0)
                {
                    //MessageBox.Show("Please select the CCN ");
                    PCSMessageBox.Show(ErrorCode.MESSAGE_RGA_CCN, MessageBoxIcon.Warning);
                    cboCCN.Focus();
                    return false;
                }

                if (dtmPostDate.Value == DBNull.Value || dtmPostDate.Text.Trim() == string.Empty)
                {
                    //MessageBox.Show("Please input the Post date");
                    PCSMessageBox.Show(ErrorCode.MESSAGE_RGV_POSTDATE, MessageBoxIcon.Warning);
                    dtmPostDate.Focus();
                    return false;
                }

                //check the PostDate in the current period
                if (!FormControlComponents.CheckDateInCurrentPeriod((DateTime)dtmPostDate.Value))
                {
                    //MessageBox.Show("The Post Date you input is not in the current period");
                    PCSMessageBox.Show(ErrorCode.MESSAGE_RGV_POSTDATE_PERIOD, MessageBoxIcon.Warning);
                    dtmPostDate.Focus();
                    return false;
                }

                //HACK: Tuan TQ. 12 Jan, 2006. 
                //Post date must be in the past
                UtilsBO boUtils = new UtilsBO();
                if (((DateTime)dtmPostDate.Value) > boUtils.GetDBDate())
                {
                    PCSMessageBox.Show(ErrorCode.MESSAGE_INV_TRANSACTION_CANNOT_IN_FUTURE, MessageBoxIcon.Exclamation);
                    dtmPostDate.Focus();
                    return false;
                }
                //End hack

                if (txtIssueNo.Text.Trim() == string.Empty)
                {
                    PCSMessageBox.Show(ErrorCode.MSG_LABORTIME_TRANSNO, MessageBoxIcon.Warning);
                    txtIssueNo.Focus();
                    return false;
                }

                if (txtMasLoc.Text.Trim() == string.Empty)
                {
                    PCSMessageBox.Show(ErrorCode.MANDATORY_INVALID, MessageBoxIcon.Warning);
                    txtMasLoc.Focus();
                    return false;
                }

                if (txtToLocation.Text.Trim() == string.Empty)
                {
                    PCSMessageBox.Show(ErrorCode.MANDATORY_INVALID, MessageBoxIcon.Warning);
                    txtToLocation.Focus();
                    return false;
                }

                if (txtToBin.Text == string.Empty)
                {
                    PCSMessageBox.Show(ErrorCode.MESSAGE_IV_ADJUSTMENT_PLS_INPUT_BIN);
                    txtToBin.Focus();
                    return false;
                }

                if (txtPurpose.Text.Trim() == string.Empty)
                {
                    PCSMessageBox.Show(ErrorCode.MANDATORY_INVALID, MessageBoxIcon.Warning);
                    txtPurpose.Focus();
                    return false;
                }				

                int intDetailRows = dgrdData.RowCount;

                if (intDetailRows <= 0)
                {
                    //MessageBox.Show("Please insert a list of labor time ");
                    PCSMessageBox.Show(ErrorCode.MESSAGE_PLEASE_ENTER_DETAIL_INFOR, MessageBoxIcon.Warning);

                    dgrdData.Focus();
                    dgrdData.Row = 0;
                    dgrdData.Col = dstData.Tables[0].Columns.IndexOf(WORKORDERNO_COL);

                    return false;
                }
                //Check postdate in configuration
                if (!FormControlComponents.CheckPostDateInConfiguration((DateTime)dtmPostDate.Value))
                {
                    return false;
                }
                return true;
            }
            catch (Exception ex)
            {
                throw new Exception(ex.Message, ex);
            }
        }

        /// <summary>
        /// Validate all the mandatory fields in the grid
        /// </summary>
        /// <returns></returns>
        private bool CheckManatoryColumnInGrid()
        {
            try
            {
                if ((dstData.Tables.Count <= 0) || (dgrdData.RowCount <= 0)) return false;

                int intTotalRow = dgrdData.RowCount;
                
                for (int intRow = 0; intRow < intTotalRow; intRow++)
                {
                    // set selected row first
                    dgrdData.Row = intRow;

                    decimal decCommitQuantity = 0;
                    decimal decCommitAvailable = 0;

                    // select work order first
                    if (dgrdData[intRow, PRO_IssueMaterialDetailTable.WORKORDERMASTERID_FLD] == DBNull.Value
                        || dgrdData[intRow, PRO_IssueMaterialDetailTable.WORKORDERMASTERID_FLD].ToString().Trim() == string.Empty)
                    {
                        //MessageBox.Show("Please select a work order");
                        PCSMessageBox.Show(ErrorCode.MSG_LABORTIME_SELECTWOMASTER, MessageBoxIcon.Warning);
                        dgrdData.Col = dstData.Tables[0].Columns.IndexOf(WORKORDERNO_COL);
                        dgrdData.Focus();
                        dgrdData.Select();
                        return false;
                    }

                    if (dgrdData[intRow, PRO_IssueMaterialDetailTable.WORKORDERDETAILID_FLD] == DBNull.Value || dgrdData[intRow, PRO_LaborTimeDetailTable.WORKORDERDETAILID_FLD].ToString().Trim() == string.Empty)
                    {
                        //MessageBox.Show("Please input the return line of the work order");
                        PCSMessageBox.Show(ErrorCode.MSG_LABORTIME_SELECTWODETAIL, MessageBoxIcon.Warning);
                        dgrdData.Col = dstData.Tables[0].Columns.IndexOf(WORKORDERLINE_COL);
                        dgrdData.Focus();
                        dgrdData.Select();
                        return false;
                    }

                    if (dgrdData[intRow, PRO_IssueMaterialDetailTable.LOCATIONID_FLD] == DBNull.Value
                        || dgrdData[intRow, PRO_IssueMaterialDetailTable.LOCATIONID_FLD].ToString().Trim() == string.Empty)
                    {
                        //MessageBox.Show("Please input the location for issusing material");
                        PCSMessageBox.Show(ErrorCode.MSG_WOISSUE_MATERIAL_SELECT_LOCATION, MessageBoxIcon.Warning);
                        dgrdData.Col = dstData.Tables[0].Columns.IndexOf(LOCATIONCODE_COL);
                        dgrdData.Focus();
                        dgrdData.Select();
                        return false;
                    }

                    if (dgrdData[intRow, BINCODE_COL].ToString().Trim() == string.Empty)
                    {
                        PCSMessageBox.Show(ErrorCode.MESSAGE_IV_ADJUSTMENT_PLS_INPUT_BIN, MessageBoxIcon.Warning);
                        dgrdData.Col = dgrdData.Splits[0].DisplayColumns.IndexOf(dgrdData.Splits[0].DisplayColumns[BINCODE_COL]);
                        dgrdData.Focus();
                        dgrdData.Select();
                        return false;
                    }

                    //HACK: added by Tuan TQ. 23 Jan, 2006. From Bin must be diffirent from To Bin
                    if (dgrdData[intRow, PRO_IssueMaterialDetailTable.BINID_FLD].Equals(txtToBin.Tag)
                    && (txtToBin.Tag.ToString() != string.Empty))
                    {
                        PCSMessageBox.Show(ErrorCode.MESSAGE_LOCTOLOC_DIFFERENCE_BIN, MessageBoxIcon.Warning);
                        dgrdData.Col = dgrdData.Splits[0].DisplayColumns.IndexOf(dgrdData.Splits[0].DisplayColumns[BINCODE_COL]);
                        dgrdData.Focus();
                        dgrdData.Select();
                        return false;
                    }
                    //End hack					

                    // lot control
                    if (dgrdData[intRow, ITM_ProductTable.LOTCONTROL_FLD].ToString() == 1.ToString())
                    {
                        if (dgrdData[intRow, PRO_IssueMaterialDetailTable.LOT_FLD].ToString() == string.Empty)
                        {
                            PCSMessageBox.Show(ErrorCode.MESSAGE_LOCTOLOC_SELECT_LOT, MessageBoxIcon.Warning);
                            dgrdData.Col = dgrdData.Splits[0].DisplayColumns.IndexOf(dgrdData.Splits[0].DisplayColumns[PRO_IssueMaterialDetailTable.LOT_FLD]);
                            dgrdData.Focus();
                            dgrdData.Select();
                            return false;
                        }
                    }

                    if (dgrdData[intRow, PRO_IssueMaterialDetailTable.PRODUCTID_FLD] == DBNull.Value
                        || dgrdData[intRow, PRO_IssueMaterialDetailTable.PRODUCTID_FLD].ToString().Trim() == string.Empty)
                    {
                        //MessageBox.Show("Please input the product for this row");
                        PCSMessageBox.Show(ErrorCode.MSG_WOISSUE_MATERIAL_SELECT_COMPONENT, MessageBoxIcon.Warning);
                        dgrdData.Col = dstData.Tables[0].Columns.IndexOf(PRODUCTCODE_COL);
                        dgrdData.Focus();
                        dgrdData.Select();
                        return false;
                    }

                    try
                    {
                        decCommitQuantity = decimal.Parse(dgrdData[intRow, PRO_IssueMaterialDetailTable.COMMITQUANTITY_FLD].ToString());
                    }
                    catch
                    {
                        PCSMessageBox.Show(ErrorCode.MESSAGE_INVALID_NUMERIC, MessageBoxIcon.Warning);
                        dgrdData.Col = dstData.Tables[0].Columns.IndexOf(PRO_IssueMaterialDetailTable.COMMITQUANTITY_FLD);
                        dgrdData.Focus();
                        dgrdData.Select();
                        return false;
                    }

                    try
                    {
                        decCommitAvailable = decimal.Parse(dgrdData[intRow, PRO_IssueMaterialDetailTable.AVAILABLEQUANTITY_FLD].ToString());
                    }
                    catch
                    {
                        PCSMessageBox.Show(ErrorCode.MESSAGE_INVALID_NUMERIC, MessageBoxIcon.Warning);
                        dgrdData.Col = dstData.Tables[0].Columns.IndexOf(PRO_IssueMaterialDetailTable.AVAILABLEQUANTITY_FLD);
                        dgrdData.Focus();
                        dgrdData.Select();
                        return false;
                    }
                    if (decCommitQuantity <= 0)
                    {
                        //MessageBox.Show("The commit quantity must be higher than 0");
                        PCSMessageBox.Show(ErrorCode.MSG_WOISSUE_MATERIAL_COMMIT_QTY_GREATER_THAN_ZERO, MessageBoxIcon.Warning);
                        dgrdData.Col = dstData.Tables[0].Columns.IndexOf(PRO_IssueMaterialDetailTable.COMMITQUANTITY_FLD);
                        dgrdData.Focus();
                        dgrdData.Select();
                        return false;
                    }
                    else
                    {
                        // check available quantity to commit
                        try
                        {
                            if (decimal.Parse(dgrdData[intRow, AVAILABLE_QUANTITY].ToString()) <= 0)
                            {
                                PCSMessageBox.Show(ErrorCode.MESSAGE_AVAILABLE_QTY_MUST_GREATER_THAN_ZERO, MessageBoxIcon.Warning);
                                dgrdData.Col = dstData.Tables[0].Columns.IndexOf(AVAILABLE_QUANTITY);
                                dgrdData.Focus();
                                dgrdData.Select();
                                return false;
                            }
                        }
                        catch
                        {
                            PCSMessageBox.Show(ErrorCode.MESSAGE_INVALID_NUMERIC, MessageBoxIcon.Warning);
                            dgrdData.Col = dstData.Tables[0].Columns.IndexOf(AVAILABLE_QUANTITY);
                            dgrdData.Focus();
                            dgrdData.Select();
                            return false;
                        }

                        //count for total Commit Quantity at another rows
                        for (int i = 0; i < dgrdData.RowCount; i++)
                        {
                            //Check if the row have same ProductID, LocationID and BinID with current row
                            if ((!dgrdData[i, PRO_IssueMaterialDetailTable.BINID_FLD].Equals(dgrdData[dgrdData.Row, PRO_IssueMaterialDetailTable.BINID_FLD])) ||
                                (!dgrdData[i, PRO_IssueMaterialDetailTable.LOCATIONID_FLD].Equals(dgrdData[dgrdData.Row, PRO_IssueMaterialDetailTable.LOCATIONID_FLD])) ||
                                (!dgrdData[i, PRO_IssueMaterialDetailTable.PRODUCTID_FLD].Equals(dgrdData[dgrdData.Row, PRO_IssueMaterialDetailTable.PRODUCTID_FLD])) ||
                                (i == dgrdData.Row))
                            {
                                continue;
                            }
                            try
                            {
                                decCommitQuantity += decimal.Parse(dgrdData[i, PRO_IssueMaterialDetailTable.COMMITQUANTITY_FLD].ToString());
                                decCommitAvailable += decimal.Parse(dgrdData[i, PRO_IssueMaterialDetailTable.AVAILABLEQUANTITY_FLD].ToString());
                            }
                            catch
                            {
                            }
                        }

                        //check the available quantity to commit
                        //if (!CheckValidCommitQty(decCommitQuantity, string.Empty, string.Empty))
                        if (decCommitQuantity > decCommitAvailable)
                        {
                            dgrdData.Col = dstData.Tables[0].Columns.IndexOf(PRO_IssueMaterialDetailTable.COMMITQUANTITY_FLD);
                            dgrdData.Focus();
                            dgrdData.Select();
                            return false;
                        }
                    }

                    //Check if ToLoc = FromLoc
                    if (issueMaterialMaster.ToLocationID == int.Parse(dgrdData[intRow, PRO_IssueMaterialDetailTable.LOCATIONID_FLD].ToString()))
                    {
                        string[] strParam = new string[2];
                        if (issueMaterialMaster.ToBinID != 0)
                        {
                            if (issueMaterialMaster.ToBinID == int.Parse(dgrdData[intRow, PRO_IssueMaterialDetailTable.BINID_FLD].ToString()))
                            {
                                strParam[0] = lblToBin.Text;
                                strParam[1] = lblFromBin.Text;
                                PCSMessageBox.Show(ErrorCode.MESSAGE_INTERSECT_NOT_ALLOWED, MessageBoxIcon.Warning, strParam);
                                dgrdData.Col = dstData.Tables[0].Columns.IndexOf(MST_BINTable.TABLE_NAME + MST_BINTable.CODE_FLD);
                                dgrdData.Focus();
                                return false;
                            }
                        }
                        else
                        {
                            strParam[0] = lblToLocation.Text;
                            strParam[1] = lblFromLoc.Text;
                            PCSMessageBox.Show(ErrorCode.MESSAGE_INTERSECT_NOT_ALLOWED, MessageBoxIcon.Warning, strParam);
                            dgrdData.Col = dstData.Tables[0].Columns.IndexOf(MST_LocationTable.TABLE_NAME + MST_LocationTable.CODE_FLD);
                            dgrdData.Focus();
                            return false;
                        }
                    }
                }
                return true;
            }
            catch (Exception ex)
            {
                throw new Exception(ex.Message, ex);
            }

        }

        /// <summary>
        /// Assign value to the VO Master Object
        /// </summary>
        private void CreateIssueMaster()
        {
            issueMaterialMaster = new PRO_IssueMaterialMaster
                                      {
                                          CCNID = (int) cboCCN.SelectedValue,
                                          PostDate = (DateTime) dtmPostDate.Value,
                                          IssueNo = txtIssueNo.Text.Trim(),
                                          ShiftID = string.IsNullOrEmpty(txtShift.Text) ? null : (int?) txtShift.Tag,
                                          ToLocationID = (int?) txtToLocation.Tag,
                                          ToBinID = (int?) txtToBin.Tag,
                                          IssuePurposeID = (int?) txtPurpose.Tag,
                                          MasterLocationID = SystemProperty.MasterLocationID,
                                          LastChange = Utilities.Instance.GetDBDate(),
                                          UserName = SystemProperty.UserName
                                      };
        }

        /// <returns>return true if successful else return false</returns>
        private bool SaveData()
        {
            CreateIssueMaster();

            // synchronyze data
            FormControlComponents.SynchronyGridData(dgrdData);
            foreach (DataRow detailRow in dstData.Tables[0].Rows)
            {
                if (detailRow.RowState != DataRowState.Deleted)
                {
                    PRO_IssueMaterialDetail detail = CreateDetail(detailRow);
                    issueMaterialMaster.PRO_IssueMaterialDetails.Add(detail);
                }
            }
            var boMultiWOIssueMaterialBO = new MultiWOIssueMaterialBO();

            switch (mFormMode)
            {
                case EnumAction.Add:
                    issueMaterialMaster.IssueMaterialMasterID = boMultiWOIssueMaterialBO.InsertIssueMaterial(issueMaterialMaster);
                    break;
            }

            return true;
        }

        private PRO_IssueMaterialDetail CreateDetail(DataRow detailRow)
        {
            var newDetail = new PRO_IssueMaterialDetail();
            newDetail.Line = Convert.ToInt32(detailRow[PRO_IssueMaterialDetailTable.LINE_FLD]);
            if (detailRow[PRO_IssueMaterialDetailTable.AVAILABLEQUANTITY_FLD] != null && detailRow[PRO_IssueMaterialDetailTable.AVAILABLEQUANTITY_FLD].ToString() != string.Empty)
            {
                newDetail.AvailableQuantity = Convert.ToDecimal(detailRow[PRO_IssueMaterialDetailTable.AVAILABLEQUANTITY_FLD]);
            }
            if (detailRow[PRO_IssueMaterialDetailTable.BINID_FLD] != null && detailRow[PRO_IssueMaterialDetailTable.BINID_FLD].ToString() != string.Empty)
            {
                newDetail.BinID = Convert.ToInt32(detailRow[PRO_IssueMaterialDetailTable.BINID_FLD]);
            }
            if (detailRow[PRO_IssueMaterialDetailTable.BOMQUANTITY_FLD] != null && detailRow[PRO_IssueMaterialDetailTable.BOMQUANTITY_FLD].ToString() != string.Empty)
            {
                newDetail.BomQuantity = Convert.ToDecimal(detailRow[PRO_IssueMaterialDetailTable.BOMQUANTITY_FLD]);
            }
            if (detailRow[PRO_IssueMaterialDetailTable.COMMITQUANTITY_FLD] != null && detailRow[PRO_IssueMaterialDetailTable.COMMITQUANTITY_FLD].ToString() != string.Empty)
            {
                newDetail.CommitQuantity = Convert.ToDecimal(detailRow[PRO_IssueMaterialDetailTable.COMMITQUANTITY_FLD]);
            }
            if (detailRow[PRO_IssueMaterialDetailTable.LOCATIONID_FLD] != null && detailRow[PRO_IssueMaterialDetailTable.LOCATIONID_FLD].ToString() != string.Empty)
            {
                newDetail.LocationID = Convert.ToInt32(detailRow[PRO_IssueMaterialDetailTable.LOCATIONID_FLD]);
            }
            if (detailRow[PRO_IssueMaterialDetailTable.LOT_FLD] != null)
            {
                newDetail.Lot = detailRow[PRO_IssueMaterialDetailTable.LOT_FLD].ToString();
            }
            if (detailRow[PRO_IssueMaterialDetailTable.MASTERLOCATIONID_FLD] != null && detailRow[PRO_IssueMaterialDetailTable.MASTERLOCATIONID_FLD].ToString() != string.Empty)
            {
                newDetail.MasterLocationID = Convert.ToInt32(detailRow[PRO_IssueMaterialDetailTable.MASTERLOCATIONID_FLD]);
            }
            if (detailRow[PRO_IssueMaterialDetailTable.PRODUCTID_FLD] != null && detailRow[PRO_IssueMaterialDetailTable.PRODUCTID_FLD].ToString() != string.Empty)
            {
                newDetail.ProductID = Convert.ToInt32(detailRow[PRO_IssueMaterialDetailTable.PRODUCTID_FLD]);
            }
            if (detailRow[PRO_IssueMaterialDetailTable.QASTATUS_FLD] != null && detailRow[PRO_IssueMaterialDetailTable.QASTATUS_FLD].ToString() != string.Empty)
            {
                newDetail.QAStatus = Convert.ToByte(detailRow[PRO_IssueMaterialDetailTable.QASTATUS_FLD]);
            }
            if (detailRow[PRO_IssueMaterialDetailTable.SERIAL_FLD] != null)
            {
                newDetail.Serial = detailRow[PRO_IssueMaterialDetailTable.SERIAL_FLD].ToString();
            }
            if (detailRow[PRO_IssueMaterialDetailTable.STOCKUMID_FLD] != null && detailRow[PRO_IssueMaterialDetailTable.STOCKUMID_FLD].ToString() != string.Empty)
            {
                newDetail.StockUMID = Convert.ToInt32(detailRow[PRO_IssueMaterialDetailTable.STOCKUMID_FLD]);
            }
            if (detailRow[PRO_IssueMaterialDetailTable.WORKORDERDETAILID_FLD] != null && detailRow[PRO_IssueMaterialDetailTable.WORKORDERDETAILID_FLD].ToString() != string.Empty)
            {
                newDetail.WorkOrderDetailID = Convert.ToInt32(detailRow[PRO_IssueMaterialDetailTable.WORKORDERDETAILID_FLD]);
            }
            if (detailRow[PRO_IssueMaterialDetailTable.WORKORDERMASTERID_FLD] != null && detailRow[PRO_IssueMaterialDetailTable.WORKORDERMASTERID_FLD].ToString() != string.Empty)
            {
                newDetail.WorkOrderMasterID = Convert.ToInt32(detailRow[PRO_IssueMaterialDetailTable.WORKORDERMASTERID_FLD]);
            }
            return newDetail;
        }

        /// <summary>
        /// This method is used to clear all the associated fields with master Location
        /// Work Order
        /// </summary>
        private void ChangeMasterLocation()
        {
            // clear location and bin data
            txtToLocation.Text = string.Empty;
            txtToLocation.Tag = "0";
            txtToBin.Text = string.Empty;
            txtToBin.Tag = "0";
            // clear location and bin in grid
            if (dstData != null && dstData.Tables.Count > 0)
            {
                foreach (DataRow drowData in dstData.Tables[0].Rows)
                {
                    if (drowData.RowState == DataRowState.Deleted)
                        continue;
                    drowData[Constants.AVAILABLE_QTY_COL] = DBNull.Value;
                    drowData[MST_LocationTable.LOCATIONID_FLD] = DBNull.Value;
                    drowData[MST_BINTable.BINID_FLD] = DBNull.Value;
                    drowData[LOCATIONCODE_COL] = string.Empty;
                    drowData[BINCODE_COL] = string.Empty;
                }
            }
        }

        /// <summary>
        /// Load data from search result to control
        /// </summary>
        /// <param name="drData">Search result row</param>
        private void LoadData(DataRow drData)
        {
            if (drData == null)
            {
                ClearForm();
                EnableDisableButtons();
                return;
            }

            issueMaterialMaster = new PRO_IssueMaterialMaster();
            issueMaterialMaster.CCNID = int.Parse(drData[PRO_IssueMaterialMasterTable.CCNID_FLD].ToString());
            issueMaterialMaster.IssueMaterialMasterID = int.Parse(drData[PRO_IssueMaterialMasterTable.ISSUEMATERIALMASTERID_FLD].ToString());
            txtIssueNo.Tag = issueMaterialMaster.IssueMaterialMasterID;
            issueMaterialMaster.IssueNo = drData[PRO_IssueMaterialMasterTable.ISSUENO_FLD].ToString();
            issueMaterialMaster.PostDate = (DateTime)drData[PRO_IssueMaterialMasterTable.POSTDATE_FLD];
            issueMaterialMaster.MasterLocationID = int.Parse(drData[PRO_IssueMaterialMasterTable.MASTERLOCATIONID_FLD].ToString());
            issueMaterialMaster.IssuePurposeID = int.Parse(drData[PRO_IssueMaterialMasterTable.ISSUEPURPOSEID_FLD].ToString());
            issueMaterialMaster.ToLocationID = int.Parse(drData[PRO_IssueMaterialMasterTable.TOLOCATIONID_FLD].ToString());
            issueMaterialMaster.ShiftID = drData[PRO_IssueMaterialMasterTable.SHIFTID_FLD].ToString().Trim() !=
                                          string.Empty ? int.Parse(drData[PRO_IssueMaterialMasterTable.SHIFTID_FLD].ToString())
                                              : 0;


            //display the master information
            //1.CCN ID
            cboCCN.SelectedValue = drData[PRO_IssueMaterialMasterTable.CCNID_FLD];
            //2.Post Date
            dtmPostDate.Value = drData[PRO_IssueMaterialMasterTable.POSTDATE_FLD];
            //3.Transno
            txtIssueNo.Text = drData[PRO_IssueMaterialMasterTable.ISSUENO_FLD].ToString();

            // Get Master information
            MultiWOIssueMaterialBO boMultiWOIssueMaterialBO = new MultiWOIssueMaterialBO();
            DataTable dtbMasterIssue = boMultiWOIssueMaterialBO.GetMasterIssue(issueMaterialMaster.IssueMaterialMasterID);

            //4.Master Location Code
            txtMasLoc.Text = dtbMasterIssue.Rows[0]["MasLoc"].ToString();
            issueMaterialMaster.MasterLocationID = Convert.ToInt32(dtbMasterIssue.Rows[0]["MasterLocationID"]);
            //5.ToLocation
            txtToLocation.Text = dtbMasterIssue.Rows[0]["Location"].ToString();
            //6.Purpose
            txtPurpose.Text = dtbMasterIssue.Rows[0]["ISSUEPURPOSE"].ToString();
            //7.ToBin
            if ((drData[PRO_IssueMaterialMasterTable.TOBINID_FLD] != DBNull.Value) && (drData[PRO_IssueMaterialMasterTable.TOBINID_FLD].ToString() != 0.ToString()))
            {
                issueMaterialMaster.ToBinID = int.Parse(drData[PRO_IssueMaterialMasterTable.TOBINID_FLD].ToString());
                txtToBin.Text = dtbMasterIssue.Rows[0]["BIN"].ToString();
            }
            //8.Shift
            txtShift.Text = dtbMasterIssue.Rows[0]["ShiftDesc"].ToString();
            if (dtbMasterIssue.Rows[0]["ShiftID"].ToString().Trim() != string.Empty)
            {
                txtShift.Tag = Convert.ToInt32(dtbMasterIssue.Rows[0]["ShiftID"]);
            }
            else
            {
                txtShift.Tag = 0;
            }
            LoadDetailData(issueMaterialMaster.PostDate, issueMaterialMaster.IssueMaterialMasterID, issueMaterialMaster.CCNID, issueMaterialMaster.MasterLocationID);
            //End hack

            EnableDisableButtons();
        }

        /// <summary>
        /// update the value to the other associated column after searching
        /// </summary>
        /// <param name="strColumnName"></param>
        /// <param name="strColumnValue"></param>
        /// <param name="drvResult"></param>
        /// <param name="blnButtonClick"></param>
        private void UpdateValueAfterSearch(string strColumnName, string strColumnValue, DataRowView drvResult, bool blnButtonClick)
        {
            switch (strColumnName)
            {
                case WORKORDERNO_COL:
                    if (drvResult != null)
                    {
                        //update the associated column
                        dgrdData.Columns[PRO_IssueMaterialDetailTable.WORKORDERMASTERID_FLD].Value = drvResult[PRO_WorkOrderMasterTable.WORKORDERMASTERID_FLD];
                        dgrdData.Columns[WORKORDERNO_COL].Value = drvResult[PRO_WorkOrderMasterTable.WORKORDERNO_FLD];
                        //clear the associated column
                        //Work Order Detail ID
                        dgrdData.Columns[PRO_IssueMaterialDetailTable.WORKORDERDETAILID_FLD].Value = string.Empty;
                        dgrdData.Columns[WORKORDERLINE_COL].Value = string.Empty;

                        //Product Column
                        UpdateProductInfo(null);

                    }
                    else if (strColumnValue == string.Empty && !blnButtonClick)
                    {
                        dgrdData.Columns[PRO_IssueMaterialDetailTable.WORKORDERMASTERID_FLD].Value = string.Empty;
                        dgrdData.Columns[WORKORDERNO_COL].Value = string.Empty;

                        //Work Order Detail ID
                        dgrdData.Columns[PRO_IssueMaterialDetailTable.WORKORDERDETAILID_FLD].Value = string.Empty;
                        dgrdData.Columns[WORKORDERLINE_COL].Value = string.Empty;

                        //Product Column
                        UpdateProductInfo(null);
                    }

                    break;

                case WORKORDERLINE_COL:
                    if (drvResult != null)
                    {
                        //update the associated column
                        dgrdData.Columns[PRO_IssueMaterialDetailTable.WORKORDERDETAILID_FLD].Value = drvResult[PRO_WorkOrderDetailTable.WORKORDERDETAILID_FLD];
                        dgrdData.Columns[WORKORDERLINE_COL].Value = drvResult[PRO_WorkOrderDetailTable.LINE_FLD];
                        
                        //Product Column
                        UpdateProductInfo(null);
                    }
                    else if (strColumnValue == string.Empty && !blnButtonClick)
                    {
                        //clear all the other columns
                        //Work Order Detail ID
                        dgrdData.Columns[PRO_IssueMaterialDetailTable.WORKORDERDETAILID_FLD].Value = string.Empty;
                        dgrdData.Columns[WORKORDERLINE_COL].Value = string.Empty;

                        //Product Column
                        UpdateProductInfo(null);
                    }

                    break;

                case MST_MasterLocationTable.TABLE_NAME + MST_MasterLocationTable.CODE_FLD:
                    if (drvResult != null)
                    {
                        issueMaterialMaster.MasterLocationID = int.Parse(drvResult[MST_MasterLocationTable.MASTERLOCATIONID_FLD].ToString());
                        txtMasLoc.Text = drvResult[MST_MasterLocationTable.CODE_FLD].ToString();
                        ChangeMasterLocation();

                    }
                    else if (strColumnValue == string.Empty && !blnButtonClick)
                    {
                        issueMaterialMaster.MasterLocationID = 0;
                        ChangeMasterLocation();
                    }

                    break;

                case LOCATIONCODE_COL:
                    if (drvResult != null)
                    {
                        //update the associated column
                        dgrdData.Columns[PRO_IssueMaterialDetailTable.LOCATIONID_FLD].Value = drvResult[MST_LocationTable.LOCATIONID_FLD];
                        dgrdData.Columns[LOCATIONCODE_COL].Value = drvResult[MST_LocationTable.CODE_FLD];

                        //Bin 
                        dgrdData.Columns[PRO_IssueMaterialDetailTable.BINID_FLD].Value = string.Empty;
                        dgrdData.Columns[BINCODE_COL].Value = string.Empty;

                        //other associated quantity column
                        dgrdData.Columns[Constants.AVAILABLE_QTY_COL].Value = string.Empty;
                        //Disable Bin column if this Location hasn't Bin
                        dgrdData.Columns[HASBIN].Value = bool.Parse(drvResult[MST_LocationTable.BIN_FLD].ToString()) ? 1 : 0;
                    }
                    else if (strColumnValue == string.Empty && !blnButtonClick)
                    {
                        //clear the associated column
                        dgrdData.Columns[PRO_IssueMaterialDetailTable.LOCATIONID_FLD].Value = string.Empty;
                        dgrdData.Columns[LOCATIONCODE_COL].Value = string.Empty;

                        //Bin 
                        dgrdData.Columns[PRO_IssueMaterialDetailTable.BINID_FLD].Value = string.Empty;
                        dgrdData.Columns[BINCODE_COL].Value = string.Empty;

                        //other associated quantity column
                        dgrdData.Columns[Constants.AVAILABLE_QTY_COL].Value = string.Empty;
                    }

                    break;

                case BINCODE_COL:
                    if (drvResult != null)
                    {
                        //HACK: added by Tuan TQ. 23 Jan, 2006. From Bin must be diffirent from To Bin
                        if (drvResult[MST_BINTable.BINID_FLD].Equals(txtToBin.Tag) && (txtToBin.Text != string.Empty))
                        {
                            PCSMessageBox.Show(ErrorCode.MESSAGE_LOCTOLOC_DIFFERENCE_BIN, MessageBoxIcon.Warning);
                            dgrdData.Col = dgrdData.Splits[0].DisplayColumns.IndexOf(dgrdData.Splits[0].DisplayColumns[BINCODE_COL]);
                            dgrdData.Focus();
                            dgrdData.Select();
                            return;
                        }
                        //End hack

                        //update the associated column
                        dgrdData[dgrdData.Row, PRO_IssueMaterialDetailTable.BINID_FLD] = drvResult[MST_BINTable.BINID_FLD];
                        dgrdData[dgrdData.Row, BINCODE_COL] = drvResult[MST_BINTable.CODE_FLD];

                        //other associated quantity column
                        dgrdData.Columns[Constants.AVAILABLE_QTY_COL].Value = string.Empty;
                    }
                    else if (strColumnValue == string.Empty && !blnButtonClick)
                    {
                        //clear the associated column
                        dgrdData.Columns[PRO_IssueMaterialDetailTable.BINID_FLD].Value = string.Empty;
                        dgrdData.Columns[BINCODE_COL].Value = string.Empty;

                        //other associated quantity column
                        dgrdData.Columns[Constants.AVAILABLE_QTY_COL].Value = string.Empty;
                    }
                    break;
                case PRO_IssueMaterialDetailTable.LOT_FLD:
                    if (drvResult != null)
                    {
                        //update the associated column
                        dgrdData.Columns[PRO_IssueMaterialDetailTable.LOT_FLD].Value = drvResult[IV_LotItemTable.LOT_FLD];

                        //other related quantity
                        dgrdData.Columns[Constants.AVAILABLE_QTY_COL].Value = string.Empty;
                        dgrdData.Columns[Constants.COMMITED_QTY_COL].Value = string.Empty;
                        dgrdData.Columns[Constants.NEEDED_QTY_COL].Value = string.Empty;

                    }
                    else if (strColumnValue == string.Empty && !blnButtonClick)
                    {
                        //clear the associated column
                        dgrdData.Columns[PRO_IssueMaterialDetailTable.LOT_FLD].Value = string.Empty;

                        //other related quantity
                        dgrdData.Columns[Constants.AVAILABLE_QTY_COL].Value = string.Empty;
                        dgrdData.Columns[Constants.COMMITED_QTY_COL].Value = string.Empty;
                        dgrdData.Columns[Constants.NEEDED_QTY_COL].Value = string.Empty;
                    }
                    break;

                case PRODUCTCODE_COL:
                case PRODUCTDESC_COL:
                case PRODUCTREVISION_COL:
                    if (drvResult != null)
                    {
                        UpdateProductInfo(drvResult);
                    }
                    else if (strColumnValue == string.Empty && !blnButtonClick)
                    {
                        UpdateProductInfo(null);
                    }
                    break;
            }

            if (strColumnName != PRO_IssueMaterialDetailTable.COMMITQUANTITY_FLD)
            {
                //update the other related quantity columns
                UpdateRelatedQtyColumn();
                dgrdData.RefreshRow();
            }
        }

        /// <summary>
        /// Update the product row after searching 
        /// </summary>
        /// <param name="pdrvResult"></param>
        private void UpdateProductInfo(DataRowView pdrvResult)
        {
            DataRowView drvResult = pdrvResult;

            if (drvResult == null)
            {
                //Product Column
                dgrdData.Columns[PRO_IssueMaterialDetailTable.PRODUCTID_FLD].Value = string.Empty;
                dgrdData.Columns[PRODUCTCODE_COL].Value = string.Empty;
                dgrdData.Columns[PRODUCTDESC_COL].Value = string.Empty;
                dgrdData.Columns[PRODUCTREVISION_COL].Value = string.Empty;
                dgrdData.Columns[PRO_IssueMaterialDetailTable.STOCKUMID_FLD].Value = string.Empty;
                dgrdData.Columns[UNITCODE_COL].Value = string.Empty;
            }
            else
            {
                dgrdData.Columns[PRO_IssueMaterialDetailTable.PRODUCTID_FLD].Value = drvResult[ITM_ProductTable.PRODUCTID_FLD];
                dgrdData.Columns[PRODUCTCODE_COL].Value = drvResult[ITM_ProductTable.TABLE_NAME + ITM_ProductTable.CODE_FLD];
                dgrdData.Columns[PRODUCTDESC_COL].Value = drvResult[ITM_ProductTable.TABLE_NAME + ITM_ProductTable.DESCRIPTION_FLD];
                dgrdData.Columns[PRODUCTREVISION_COL].Value = drvResult[ITM_ProductTable.TABLE_NAME + ITM_ProductTable.REVISION_FLD];
                dgrdData.Columns[PRO_IssueMaterialDetailTable.STOCKUMID_FLD].Value = drvResult[ITM_ProductTable.STOCKUMID_FLD];
                dgrdData.Columns[UNITCODE_COL].Value = drvResult[MST_UnitOfMeasureTable.TABLE_NAME + MST_UnitOfMeasureTable.CODE_FLD];

                dgrdData.Columns[ITM_ProductTable.LOTCONTROL_FLD].Value = bool.Parse(drvResult[ITM_ProductTable.LOTCONTROL_FLD].ToString()) ? 1 : 0;
            }

            //Other related quantity
            dgrdData.Columns[PRO_IssueMaterialDetailTable.COMMITQUANTITY_FLD].Value = string.Empty;
            dgrdData.Columns[Constants.AVAILABLE_QTY_COL].Value = string.Empty;
            dgrdData.Columns[Constants.COMMITED_QTY_COL].Value = string.Empty;
            dgrdData.Columns[Constants.NEEDED_QTY_COL].Value = string.Empty;

            //Lot control
            dgrdData.Columns[PRO_IssueMaterialDetailTable.LOT_FLD].Value = string.Empty;
        }

        /// <summary>
        /// This method is used to Open a search form
        /// in case user clicks at the button or press key F4
        /// This method will call the OpenSearchForm 
        /// and this OpenSearch only display the search form
        /// </summary>
        /// <param name="strColumnName"></param>
        /// <param name="strColumnValue"></param>
        private void DisplaySearchForm(string strColumnName, string strColumnValue, bool pblnSearchOnly)
        {
            var drvResult = CallOpenSearchForm(strColumnName, strColumnValue, pblnSearchOnly);
            if (drvResult != null)
            {
                UpdateValueAfterSearch(strColumnName, strColumnValue, drvResult, true);
            }
        }

        /// <summary>
        /// This method will display a search form
        /// based on each column
        /// we have to define the Table Name, Filter Field Name, Filter Field value
        /// and the condition for each case .
        /// Based on the bool variable ==> it will search the current value or not
        /// If the blnSearchOnly = true ==> first it will search in the database ==> if it is found ==>
        /// it will return the result
        /// </summary>
        /// <param name="strColumnName"></param>
        /// <param name="strColumValue"></param>
        /// <param name="blnSearchOnly"></param>
        /// <returns></returns>
        private DataRowView CallOpenSearchForm(string strColumnName, string strColumValue, bool pblnAlwayShowDialog)
        {
            Hashtable hashSearchCondition = null;

            string strSearchTableName = string.Empty;
            string strSearchFieldName = string.Empty;
            string strSearchFieldValue = strColumValue;

            switch (strColumnName)
            {
                case MST_MasterLocationTable.TABLE_NAME + MST_MasterLocationTable.CODE_FLD:
                    strSearchTableName = MST_MasterLocationTable.TABLE_NAME;
                    strSearchFieldName = MST_MasterLocationTable.CODE_FLD;
                    hashSearchCondition = new Hashtable();
                    hashSearchCondition.Add(MST_MasterLocationTable.CCNID_FLD, cboCCN.SelectedValue);

                    break;

                case LOCATIONCODE_COL:
                    if (issueMaterialMaster.MasterLocationID <= 0)
                    {
                        PCSMessageBox.Show(ErrorCode.MSG_LABORTIME_SELECTMASLOC, MessageBoxIcon.Warning);
                        txtMasLoc.Focus();
                        return null;
                        //throw new PCSException(ErrorCode.MSG_LABORTIME_SELECTMASLOC,METHOD_NAME,null);
                    }
                    strSearchTableName = MST_LocationTable.TABLE_NAME;
                    strSearchFieldName = MST_LocationTable.CODE_FLD;
                    hashSearchCondition = new Hashtable();
                    hashSearchCondition.Add(MST_LocationTable.MASTERLOCATIONID_FLD, issueMaterialMaster.MasterLocationID);
                    break;

                case BINCODE_COL:
                    if (dgrdData[dgrdData.Row, HASBIN].ToString() == 1.ToString())
                    {
                        if (dgrdData[dgrdData.Row, PRO_IssueMaterialDetailTable.LOCATIONID_FLD] == DBNull.Value
                            || dgrdData[dgrdData.Row, PRO_IssueMaterialDetailTable.LOCATIONID_FLD].ToString().Trim() == string.Empty)
                        {
                            //MessageBox.Show("Please select the Location first");
                            PCSMessageBox.Show(ErrorCode.MSG_WOISSUE_MATERIAL_SELECT_LOCATION_FIRST, MessageBoxIcon.Warning);
                            dgrdData.Col = dgrdData.Columns.IndexOf(dgrdData.Columns[LOCATIONCODE_COL]);
                            dgrdData.Focus();
                            dgrdData.Select();

                            return null;
                        }

                        strSearchTableName = MST_BINTable.TABLE_NAME; //PRO_WORoutingTable.TABLE_NAME;
                        strSearchFieldName = MST_BINTable.CODE_FLD;
                        hashSearchCondition = new Hashtable();
                        hashSearchCondition.Add(MST_BINTable.LOCATIONID_FLD, dgrdData[dgrdData.Row, PRO_IssueMaterialDetailTable.LOCATIONID_FLD]);

                        //HACK: added by Tuan TQ. From BIN must be OK or OR Buffer (In)
                        string strConditionValue = ((int)BinTypeEnum.OK).ToString();
                        strConditionValue += "' OR " + MST_BINTable.TABLE_NAME + "." + MST_BINTable.BINTYPEID_FLD + "='" + (int)BinTypeEnum.IN;

                        hashSearchCondition.Add(MST_BINTable.BINTYPEID_FLD, strConditionValue);
                        //End Hack
                    }
                    else
                    {
                        return null;
                    }
                    break;

                case PRO_IssueMaterialDetailTable.LOT_FLD:
                    if (dgrdData[dgrdData.Row, ITM_ProductTable.LOTCONTROL_FLD].ToString() == 1.ToString())
                    {
                        if (dgrdData[dgrdData.Row, PRO_IssueMaterialDetailTable.PRODUCTID_FLD] == DBNull.Value
                            || dgrdData[dgrdData.Row, PRO_IssueMaterialDetailTable.PRODUCTID_FLD].ToString().Trim() == string.Empty)
                        {
                            //MessageBox.Show("Please select the component first");
                            PCSMessageBox.Show(ErrorCode.MSG_WOISSUE_MATERIAL_SELECT_COMPONENT_FIRST, MessageBoxIcon.Warning);
                            dgrdData.Col = dgrdData.Columns.IndexOf(dgrdData.Columns[PRODUCTCODE_COL]);
                            dgrdData.Focus();
                            dgrdData.Select();
                            return null;
                            //throw new PCSException(ErrorCode.MSG_WOISSUE_MATERIAL_SELECT_COMPONENT_FIRST,METHOD_NAME,null);
                        }

                        strSearchTableName = IV_LotItemTable.TABLE_NAME;
                        strSearchFieldName = IV_LotItemTable.LOT_FLD;
                        hashSearchCondition = new Hashtable();
                        hashSearchCondition.Add(IV_LotItemTable.PRODUCTID_FLD, dgrdData[dgrdData.Row, PRO_IssueMaterialDetailTable.PRODUCTID_FLD]);
                    }
                    else
                    {
                        return null;
                    }
                    break;
            }

            //call the search method to find out this text is existed in the database
            DataRowView drvResult = FormControlComponents.OpenSearchForm(strSearchTableName, strSearchFieldName, strSearchFieldValue, hashSearchCondition, pblnAlwayShowDialog);
            return drvResult;
        }

        /// <summary>
        /// This method is used to update the 
        /// available quantity needed quantity
        /// commited quantity
        /// </summary>
        private void UpdateRelatedQtyColumn()
        {
            if (dgrdData.DataSource == null || dgrdData.RowCount < 1)
            {
                return;
            }

            CalculateAssociatedQuantity(int.Parse(cboCCN.SelectedValue.ToString()), issueMaterialMaster.MasterLocationID, true, dstData.Tables[0]);
        }

        #endregion Methods

        #region Event Processing
        /// <summary>
        /// Implement the Add button click
        /// Initialize the default data
        /// Load the structure data into the grid
        /// </summary>
        /// <param name="sender"></param>
        /// <param name="e"></param>
        private void btnAdd_Click(object sender, EventArgs e)
        {
            const string METHOD_NAME = THIS + ".btnAdd_Click()";

            try
            {
                UtilsBO objUtilsBO = new UtilsBO();

                //Turn to Add action
                mFormMode = EnumAction.Add;

                //Unlock form
                LockForm(false);

                //clear controls
                ClearForm();

                //Chaneg to default CCN
                if (SystemProperty.CCNID > 0)
                {
                    cboCCN.SelectedValue = SystemProperty.CCNID;
                }

                //setup date
                dtmPostDate.Value = objUtilsBO.GetDBDate();


                //get the default returned goods number
                //txtIssueNo.Text = objUtilsBO.GetNoByMask(PRO_IssueMaterialMasterTable.TABLE_NAME, PRO_IssueMaterialMasterTable.ISSUENO_FLD, (DateTime) dtmPostDate.Value, "YYYYMMDD0000");
                txtIssueNo.Text = FormControlComponents.GetNoByMask(this);
                //Fill Default Master Location 
                FormControlComponents.SetDefaultMasterLocation(txtMasLoc);
                issueMaterialMaster = new PRO_IssueMaterialMaster();
                issueMaterialMaster.MasterLocationID = SystemProperty.MasterLocationID;
                //Enable Button
                EnableDisableButtons();
                //fill issue day
                FillIssueDate((DateTime)dtmPostDate.Value);
                //load default empty grid data				
                //HACK: Tuan TQ. 10 Jan, 2006. Available qty by Post Date

                LoadDetailData(DateTime.MinValue, 0, 0, 0);
                //End hack

                //focus
                dtmPostDate.Focus();
            }
            catch (PCSException ex)
            {
                // displays the error message.
                PCSMessageBox.Show(ex.mCode, MessageBoxIcon.Error);
                // log message.
                try
                {
                    Logger.LogMessage(ex.CauseException, METHOD_NAME, Level.ERROR);
                }
                catch
                {
                    PCSMessageBox.Show(ErrorCode.LOG_EXCEPTION, MessageBoxIcon.Error);
                }
            }
            catch (Exception ex)
            {
                // displays the error message.
                PCSMessageBox.Show(ErrorCode.OTHER_ERROR, MessageBoxIcon.Error);
                // log message.
                try
                {
                    Logger.LogMessage(ex, METHOD_NAME, Level.ERROR);
                }
                catch
                {
                    PCSMessageBox.Show(ErrorCode.LOG_EXCEPTION, MessageBoxIcon.Error);
                }
            }

        }
        /// <summary>
        /// Fill Issue Date
        /// </summary>
        /// <param name="pdtmPostDate"></param>
        /// <author>Trada</author>
        /// <date>Monday, September 18 2006</date>
        private void FillIssueDate(DateTime pdtmPostDate)
        {
            MultiWOIssueMaterialBO boMultiWOIssueMaterial = new MultiWOIssueMaterialBO();
            DataSet dstWorkingTime = new DataSet();
            int intYear = pdtmPostDate.Year;
            int intMonth = pdtmPostDate.Month;
            DateTime dtmWOCompDate = new DateTime();
            dstWorkingTime = boMultiWOIssueMaterial.GetWorkingTime();
            if (dstWorkingTime.Tables[0].Rows.Count == 3)
            {
                DateTime dtmStartTimeFromDB = (DateTime)dstWorkingTime.Tables[0].Rows[0][PRO_ShiftPatternTable.WORKTIMEFROM_FLD];
                //Build StartTime and EndTime 
                DateTime dtmStartTime = new DateTime(pdtmPostDate.Year, pdtmPostDate.Month, pdtmPostDate.Day,
                    dtmStartTimeFromDB.Hour, dtmStartTimeFromDB.Minute, 0);
                //DateTime dtmEndTime = dtmStartTime.AddHours(int.Parse(dstWorkingTime.Tables[0].Rows[0][PRO_WorkingTime.WORKINGHOURS_FLD].ToString()));	
                DateTime dtmEndTime = dtmStartTime.AddHours(24);
                if (pdtmPostDate >= dtmStartTime && pdtmPostDate <= dtmEndTime)
                {
                    dtmWOCompDate = new DateTime(pdtmPostDate.Year, pdtmPostDate.Month, pdtmPostDate.Day, 0, 0, 0);
                }
                else
                {
                    dtmWOCompDate = pdtmPostDate.AddDays(-1);
                    dtmWOCompDate = new DateTime(dtmWOCompDate.Year, dtmWOCompDate.Month, dtmWOCompDate.Day);
                }
                dtmIssueDay.Value = dtmWOCompDate;
            }
            else
            {
                DateTime dtmStartTimeFromDB = new DateTime(pdtmPostDate.Year, pdtmPostDate.Month, pdtmPostDate.Day, 6, 15, 0);
                DateTime dtmStartTime = new DateTime(pdtmPostDate.Year, pdtmPostDate.Month, pdtmPostDate.Day,
                    dtmStartTimeFromDB.Hour, dtmStartTimeFromDB.Minute, 0);
                //DateTime dtmEndTime = dtmStartTime.AddHours(24);	
                if (pdtmPostDate >= dtmStartTime)
                {
                    dtmWOCompDate = new DateTime(pdtmPostDate.Year, pdtmPostDate.Month, pdtmPostDate.Day, 0, 0, 0);
                }
                else
                {
                    dtmWOCompDate = pdtmPostDate.AddDays(-1);
                    dtmWOCompDate = new DateTime(dtmWOCompDate.Year, dtmWOCompDate.Month, dtmWOCompDate.Day);
                }
                dtmIssueDay.Value = dtmWOCompDate;

            }
        }

        /// <summary>
        /// This method is used to load the default data on form
        /// </summary>
        /// <param name="sender"></param>
        /// <param name="e"></param>
        private void MultiWOIssueMaterial_Load(object sender, EventArgs e)
        {
            const string METHOD_NAME = THIS + ".MultiWOIssueMaterial_Load()";
            try
            {
                //Set authorization for user
                issueMaterialMaster = new PRO_IssueMaterialMaster();

                Security objSecurity = new Security();
                this.Name = THIS;

                if (objSecurity.SetRightForUserOnForm(this, SystemProperty.UserName) == 0)
                {
                    // You don't have the right to view this item
                    PCSMessageBox.Show(ErrorCode.MESSAGE_YOU_HAVE_NO_RIGHT_TO_VIEW, MessageBoxIcon.Warning);
                    this.Close();
                    return;
                }

                //store the gridlayout
                dtStoreGridLayout = FormControlComponents.StoreGridLayout(dgrdData);

                // HACK: Trada 10-18-2005
                // Load combo box
                UtilsBO boUtil = new UtilsBO();
                DataSet dstCCN = boUtil.ListCCN();
                cboCCN.DataSource = dstCCN.Tables[MST_CCNTable.TABLE_NAME];
                cboCCN.DisplayMember = MST_CCNTable.CODE_FLD;
                cboCCN.ValueMember = MST_CCNTable.CCNID_FLD;
                FormControlComponents.PutDataIntoC1ComboBox(cboCCN, dstCCN.Tables[MST_CCNTable.TABLE_NAME], MST_CCNTable.CODE_FLD, MST_CCNTable.CCNID_FLD, MST_CCNTable.TABLE_NAME);
                if (SystemProperty.CCNID != 0)
                {
                    cboCCN.SelectedValue = SystemProperty.CCNID;
                } // END: Trada 10-18-2005
                //change the form mode
                mFormMode = EnumAction.Default;

                //Format dtmPostDate
                dtmPostDate.FormatType = FormatTypeEnum.CustomFormat;
                dtmPostDate.CustomFormat = Constants.DATETIME_FORMAT_HOUR;

                /// HACKED: Thachnn: 25/11/2005 Report COnfiguration
                /// REVIEW: these lines need to be call automatically in the Formload Section, not manual like this point				
                this.btnPrintConfiguration.Click += new EventHandler(FormControlComponents.ShowMenuReportListHandler);
                this.btnPrint.Click += new EventHandler(FormControlComponents.RunDefaultReportEntriesHandler);
                /// END HACKED: Thachnn: 25/11/2005

                //clear data
                ClearForm();
                //lock control on form
                LockForm(true);
                //Diable or Enable buttons
                EnableDisableButtons();
            }
            catch (PCSException ex)
            {
                // displays the error message.
                PCSMessageBox.Show(ex.mCode, MessageBoxIcon.Error);
                // log message.
                try
                {
                    Logger.LogMessage(ex.CauseException, METHOD_NAME, Level.ERROR);
                }
                catch
                {
                    PCSMessageBox.Show(ErrorCode.LOG_EXCEPTION, MessageBoxIcon.Error);
                }
            }
            catch (Exception ex)
            {
                // displays the error message.
                PCSMessageBox.Show(ErrorCode.OTHER_ERROR, MessageBoxIcon.Error);
                // log message.
                try
                {
                    Logger.LogMessage(ex, METHOD_NAME, Level.ERROR);
                }
                catch
                {
                    PCSMessageBox.Show(ErrorCode.LOG_EXCEPTION, MessageBoxIcon.Error);
                }
            }
        }

        /// <summary>
        /// Display form allows user to select multi work order
        /// </summary>
        /// <param name="sender"></param>
        /// <param name="e"></param>
        private void btnSelectWO_Click(object sender, EventArgs e)
        {
            const string METHOD_NAME = THIS + ".btnSelectWO_Click()";
            try
            {
                //Check Master Location
                if (issueMaterialMaster.MasterLocationID <= 0)
                {
                    PCSMessageBox.Show(ErrorCode.MESSAGE_RGA_SELECTMASLOC, MessageBoxIcon.Warning);
                    txtMasLoc.Select();
                    txtMasLoc.Focus();
                    return;
                }

                if (txtToLocation.Text.Trim() == string.Empty)
                {
                    PCSMessageBox.Show(ErrorCode.MESSAGE_RGA_SELECTLOC, MessageBoxIcon.Warning);
                    txtToLocation.Focus();
                    return;
                }

                SelectWorkOrders frmSelectWorkOrders = new SelectWorkOrders(Convert.ToInt32(txtPurpose.Tag));
                frmSelectWorkOrders.MasterLocationCode = txtMasLoc.Text;
                frmSelectWorkOrders.MasterLocationID = issueMaterialMaster.MasterLocationID;
                frmSelectWorkOrders.CCNID = int.Parse(cboCCN.SelectedValue.ToString());

                if (dtmPostDate.Text.Trim() != string.Empty && !dtmPostDate.ValueIsDbNull)
                {
                    frmSelectWorkOrders.PostDate = (DateTime)dtmPostDate.Value;
                }
                else
                {
                    frmSelectWorkOrders.PostDate = DateTime.MinValue;
                }

                frmSelectWorkOrders.CurrentLine = dgrdData.RowCount;
                    
                frmSelectWorkOrders.SourceDataSet = dstData;
                
                frmSelectWorkOrders.CCNCode = cboCCN.Text;
                frmSelectWorkOrders.ToLocationID = int.Parse(txtToLocation.Tag.ToString());

                if (frmSelectWorkOrders.ShowDialog() == DialogResult.OK)
                {
                    dstData = frmSelectWorkOrders.SelectedResultDataSet;
                    DisplayDetailData();
                }

                frmSelectWorkOrders.Close();
            }
            catch (PCSException ex)
            {
                // displays the error message.
                PCSMessageBox.Show(ex.mCode, MessageBoxIcon.Error);
                // log message.
                try
                {
                    Logger.LogMessage(ex.CauseException, METHOD_NAME, Level.ERROR);
                }
                catch
                {
                    PCSMessageBox.Show(ErrorCode.LOG_EXCEPTION, MessageBoxIcon.Error);
                }
            }
            catch (Exception ex)
            {
                // displays the error message.
                PCSMessageBox.Show(ErrorCode.OTHER_ERROR, MessageBoxIcon.Error);
                // log message.
                try
                {
                    Logger.LogMessage(ex, METHOD_NAME, Level.ERROR);
                }
                catch
                {
                    PCSMessageBox.Show(ErrorCode.LOG_EXCEPTION, MessageBoxIcon.Error);
                }
            }

        }

        /// <summary>
        /// Save data into Database
        /// </summary>
        /// <param name="sender"></param>
        /// <param name="e"></param>
        private void btnSave_Click(object sender, EventArgs e)
        {
            const string METHOD_NAME = THIS + ".btnSave_Click()";
            try
            {
                if (PCSMessageBox.Show(ErrorCode.MESSAGE_CONFIRM_BEFORE_SAVE_WOCOMPLETION, MessageBoxButtons.YesNo, MessageBoxIcon.Question, MessageBoxDefaultButton.Button2, new string[] { dtmPostDate.Text }) == DialogResult.Yes)
                {
                    blnHasError = true;

                    if (Security.IsDifferencePrefix(this, lblIssueNo, txtIssueNo) ||
                        dgrdData.EditActive ||
                        !ValidateMandatoryControl() ||
                        !CheckManatoryColumnInGrid())
                        return;

                    if (SaveData())
                    {
                        //Turn to Add action
                        mFormMode = EnumAction.Default;

                        //lock form
                        LockForm(true);

                        //Enable Button
                        EnableDisableButtons();
                        Security.UpdateUserNameModifyTransaction(this, PRO_IssueMaterialMasterTable.ISSUEMATERIALMASTERID_FLD, issueMaterialMaster.IssueMaterialMasterID);
                        PCSMessageBox.Show(ErrorCode.MESSAGE_AFTER_SAVE_DATA, MessageBoxIcon.Information);
                        blnHasError = false;
                    }
                }
            }
            catch (PCSException ex)
            {
                // displays the error message.
                PCSMessageBox.Show(ex.mCode, MessageBoxIcon.Error);
                //Check if IssueNo was duplicated
                if (ex.mCode == ErrorCode.DUPLICATE_KEY)
                {
                    txtIssueNo.Focus();
                    txtIssueNo.Select();
                }
                // log message.
                try
                {
                    Logger.LogMessage(ex.CauseException, METHOD_NAME, Level.ERROR);
                }
                catch
                {
                    PCSMessageBox.Show(ErrorCode.LOG_EXCEPTION, MessageBoxIcon.Error);
                }
            }
            catch (Exception ex)
            {
                // displays the error message.
                PCSMessageBox.Show(ErrorCode.OTHER_ERROR, MessageBoxIcon.Error);
                // log message.
                try
                {
                    Logger.LogMessage(ex, METHOD_NAME, Level.ERROR);
                }
                catch
                {
                    PCSMessageBox.Show(ErrorCode.LOG_EXCEPTION, MessageBoxIcon.Error);
                }
            }

        }

        /// <summary>
        /// Implement the F4 Key
        /// </summary>
        /// <param name="sender"></param>
        /// <param name="e"></param>
        private void txtMasLoc_KeyDown(object sender, KeyEventArgs e)
        {
            try
            {
                if (e.KeyCode == Keys.F4)
                {
                    if (btnFindMasLoc.Enabled)
                    {
                        btnFindMasLoc_Click(null, null);
                    }
                }
            }
            catch (Exception ex)
            {
                throw new Exception(ex.Message, ex);
            }
        }

        private void btnFindMasLoc_Click(object sender, EventArgs e)
        {
            const string METHOD_NAME = THIS + ".btnMasLoc_Click()";
            try
            {
                if (cboCCN.SelectedIndex < 0)
                {
                    string[] msg = { lblCCN.Text, lblMasLoc.Text };
                    PCSMessageBox.Show(ErrorCode.MESSAGE_SELECT_ONE_BEFORE_SELECT_ONE, MessageBoxIcon.Warning, msg);
                    if (txtMasLoc.Text.Trim() != string.Empty)
                        txtMasLoc.Focus();
                    else
                        cboCCN.Focus();
                    return;
                }
                Hashtable hastCondition = new Hashtable();
                hastCondition.Add(MST_MasterLocationTable.CCNID_FLD, cboCCN.SelectedValue);
                DataRowView drwResult = null;

                // HACK: dungla 10-18-2005
                drwResult = FormControlComponents.OpenSearchForm(v_MasterLocationNoSecurity.TABLE_NAME, v_MasterLocationNoSecurity.CODE_FLD, txtMasLoc.Text.Trim(), hastCondition, true);
                // END: dungla 10-18-2005
                if (drwResult != null)
                {
                    // HACK: Trada 27-10-2005
                    if (issueMaterialMaster.MasterLocationID != 0)
                    {
                        if (issueMaterialMaster.MasterLocationID != int.Parse(drwResult[MST_MasterLocationTable.MASTERLOCATIONID_FLD].ToString()))
                        {
                            txtToBin.Text = string.Empty;
                            txtToBin.Tag = "0";
                            txtToLocation.Text = string.Empty;
                            txtToLocation.Tag = "0";

                            issueMaterialMaster.ToBinID = 0;
                            issueMaterialMaster.ToLocationID = 0;
                            LoadDetailData(DateTime.MinValue, 0, 0, 0);
                            //End hack
                        }
                    }
                    // END: Trada 27-10-2005

                    issueMaterialMaster.MasterLocationID = int.Parse(drwResult[MST_MasterLocationTable.MASTERLOCATIONID_FLD].ToString());
                    txtMasLoc.Text = drwResult[MST_MasterLocationTable.CODE_FLD].ToString();
                    txtMasLoc.Tag = drwResult[MST_MasterLocationTable.MASTERLOCATIONID_FLD];

                    strLastValidMasLoc = txtMasLoc.Text;

                    ChangeMasterLocation();
                }
                else
                {
                    // HACK: dungla 10-18-2005
                    txtMasLoc.Focus();
                    txtMasLoc.SelectAll();
                    // END: dungla 10-18-2005

                    txtToBin.Text = string.Empty;
                    txtToBin.Tag = "0";
                    txtToLocation.Text = string.Empty;
                    txtToLocation.Tag = "0";
                }
            }
            catch (PCSException ex)
            {
                // displays the error message.
                PCSMessageBox.Show(ex.mCode, MessageBoxIcon.Error);
                // log message.
                try
                {
                    Logger.LogMessage(ex.CauseException, METHOD_NAME, Level.ERROR);
                }
                catch
                {
                    PCSMessageBox.Show(ErrorCode.LOG_EXCEPTION, MessageBoxIcon.Error);
                }
            }
            catch (Exception ex)
            {
                // displays the error message.
                PCSMessageBox.Show(ErrorCode.OTHER_ERROR, MessageBoxIcon.Error);
                // log message.
                try
                {
                    Logger.LogMessage(ex, METHOD_NAME, Level.ERROR);
                }
                catch
                {
                    PCSMessageBox.Show(ErrorCode.LOG_EXCEPTION, MessageBoxIcon.Error);
                }
            }

        }

        private void cboCCN_SelectedValueChanged(object sender, EventArgs e)
        {
            const string METHOD_NAME = THIS + ".cboCCN_SelectedValueChanged()";
            try
            {
                issueMaterialMaster.MasterLocationID = 0;
                txtMasLoc.Text = string.Empty;
                ChangeMasterLocation();
            }
            catch (Exception ex)
            {
                // displays the error message.
                PCSMessageBox.Show(ErrorCode.OTHER_ERROR, MessageBoxIcon.Error);
                // log message.
                try
                {
                    Logger.LogMessage(ex, METHOD_NAME, Level.ERROR);
                }
                catch
                {
                    PCSMessageBox.Show(ErrorCode.LOG_EXCEPTION, MessageBoxIcon.Error);
                }
            }

        }

        private void btnClose_Click(object sender, EventArgs e)
        {
            this.Close();
        }

        /// <summary>
        /// Implement the closing method
        /// </summary>
        /// <param name="sender"></param>
        /// <param name="e"></param>
        private void MultiWOIssueMaterial_Closing(object sender, CancelEventArgs e)
        {
            const string METHOD_NAME = THIS + ".MultiWOIssueMaterial_Closing()";
            try
            {
                if (mFormMode == EnumAction.Add || mFormMode == EnumAction.Edit)
                {
                    DialogResult dlgResult = PCSMessageBox.Show(ErrorCode.MESSAGE_QUESTION_STORE_INTO_DATABASE, MessageBoxButtons.YesNoCancel, MessageBoxIcon.Question);
                    switch (dlgResult)
                    {
                        case DialogResult.Yes:

                            #region  DEL Trada 13-12-2005

                            //							if (!ValidateMandatoryControl())
                            //							{
                            //								e.Cancel = true;
                            //								break;
                            //							}
                            //							if (!CheckManatoryColumnInGrid())
                            //							{
                            //								e.Cancel = true;
                            //								break;
                            //							}
                            //							SaveData();

                            #endregion

                            // HACK: Trada 13-12-2005
                            btnSave_Click(btnSave, new EventArgs());
                            if (blnHasError)
                            {
                                e.Cancel = true;
                            }
                            // END: Trada 13-12-2005

                            break;
                        case DialogResult.No:
                            e.Cancel = false;
                            break;
                        case DialogResult.Cancel:
                            e.Cancel = true;
                            break;
                    }
                }
            }
            catch (PCSException ex)
            {
                // displays the error message.
                PCSMessageBox.Show(ex.mCode, MessageBoxIcon.Error);
                // log message.
                try
                {
                    Logger.LogMessage(ex.CauseException, METHOD_NAME, Level.ERROR);
                }
                catch
                {
                    PCSMessageBox.Show(ErrorCode.LOG_EXCEPTION, MessageBoxIcon.Error);
                }
                e.Cancel = true;
            }
            catch (Exception ex)
            {
                // displays the error message.
                PCSMessageBox.Show(ErrorCode.OTHER_ERROR, MessageBoxIcon.Error);
                // log message.
                try
                {
                    Logger.LogMessage(ex, METHOD_NAME, Level.ERROR);
                }
                catch
                {
                    PCSMessageBox.Show(ErrorCode.LOG_EXCEPTION, MessageBoxIcon.Error);
                }
                e.Cancel = true;

            }
        }

        private void MultiWOIssueMaterial_KeyDown(object sender, KeyEventArgs e)
        {
            const string METHOD_NAME = THIS + ".MachineTime_KeyDown()";
        }

        private void txtIssueNo_Enter(object sender, EventArgs e)
        {
            const string METHOD_NAME = THIS + ". txtIssueNo_Enter()";
            try
            {
                FormControlComponents.OnEnterControl(sender, e);
            }
            catch (Exception ex)
            {
                // displays the error message.
                PCSMessageBox.Show(ErrorCode.OTHER_ERROR, MessageBoxButtons.OK, MessageBoxIcon.Error);
                // log message.
                try
                {
                    Logger.LogMessage(ex, METHOD_NAME, Level.ERROR);
                }
                catch
                {
                    PCSMessageBox.Show(ErrorCode.LOG_EXCEPTION, MessageBoxButtons.OK, MessageBoxIcon.Error);
                }
            }
        }

        private void txtIssueNo_KeyDown(object sender, KeyEventArgs e)
        {
            try
            {
                if (e.KeyCode == Keys.F4)
                {
                    if (btnFindIssueNo.Enabled)
                    {
                        btnFindIssueNo_Click(null, null);
                    }
                }
            }
            catch (Exception ex)
            {
                throw new Exception(ex.Message, ex);
            }

        }

        /// <summary>
        /// After leaving the control
        /// The system will check for the Issue Code
        /// if it is found, it will display the detail data 
        /// other wise, it will display the search form for user to select the right issue code
        /// </summary>
        /// <param name="sender"></param>
        /// <param name="e"></param>
        private void txtIssueNo_Leave(object sender, EventArgs e)
        {
            const string METHOD_NAME = THIS + ".txtIssueNo_Leave()";

            try
            {
                if (btnFindIssueNo.Enabled && txtIssueNo.Modified)
                {
                    if (txtIssueNo.Text.Trim() != string.Empty)
                        btnFindIssueNo_Click(sender, e);
                    else
                    {
                        LoadData(null);
                    }
                }
                FormControlComponents.OnLeaveControl(sender, e);
            }
            catch (PCSException ex)
            {
                // displays the error message.
                PCSMessageBox.Show(ex.mCode, MessageBoxIcon.Error);
                // log message.
                try
                {
                    Logger.LogMessage(ex.CauseException, METHOD_NAME, Level.ERROR);
                }
                catch
                {
                    PCSMessageBox.Show(ErrorCode.LOG_EXCEPTION, MessageBoxIcon.Error);
                }
            }
            catch (Exception ex)
            {
                // displays the error message.
                PCSMessageBox.Show(ErrorCode.OTHER_ERROR, MessageBoxButtons.OK, MessageBoxIcon.Error);
                // log message.
                try
                {
                    Logger.LogMessage(ex, METHOD_NAME, Level.ERROR);
                }
                catch
                {
                    PCSMessageBox.Show(ErrorCode.LOG_EXCEPTION, MessageBoxButtons.OK, MessageBoxIcon.Error);
                }
            }
        }

        private void btnFindIssueNo_Click(object sender, EventArgs e)
        {
            const string METHOD_NAME = THIS + ".btnFindTransNo_Click()";
            try
            {
                Hashtable hashtCondition = null;

                DataRowView drwResult = null;
                if (sender is TextBox && sender != null)
                {
                    drwResult = FormControlComponents.OpenSearchForm(v_PROIssueWithFGoodsCode.TABLE_NAME, PRO_IssueMaterialMasterTable.ISSUENO_FLD, txtIssueNo.Text.Trim(), hashtCondition, false);
                }
                else
                {
                    drwResult = FormControlComponents.OpenSearchForm(v_PROIssueWithFGoodsCode.TABLE_NAME, PRO_IssueMaterialMasterTable.ISSUENO_FLD, txtIssueNo.Text.Trim(), hashtCondition, true);
                }
                // END: dungla 10-18-2005
                if (drwResult != null)
                {
                    LoadData(drwResult.Row);
                }
                else
                {
                    txtIssueNo.Focus();
                    txtIssueNo.SelectAll();
                }
            }
            catch (PCSException ex)
            {
                // displays the error message.
                PCSMessageBox.Show(ex.mCode, MessageBoxIcon.Error);
                // log message.
                try
                {
                    Logger.LogMessage(ex.CauseException, METHOD_NAME, Level.ERROR);
                }
                catch
                {
                    PCSMessageBox.Show(ErrorCode.LOG_EXCEPTION, MessageBoxIcon.Error);
                }
            }
            catch (Exception ex)
            {
                // displays the error message.
                PCSMessageBox.Show(ErrorCode.OTHER_ERROR, MessageBoxIcon.Error);
                // log message.
                try
                {
                    Logger.LogMessage(ex, METHOD_NAME, Level.ERROR);
                }
                catch
                {
                    PCSMessageBox.Show(ErrorCode.LOG_EXCEPTION, MessageBoxIcon.Error);
                }
            }
        }

        /// <summary>
        /// This method is used to validate the data
        /// before it is updated back to the dataset and grid
        /// It is the same as leave method in the text bo
        /// This method will check the data for 
        /// Work Order Master, Work Order Detail, Employee, ect..
        /// If this value doesn't exit in the table, it will open a search form for user to select 
        /// </summary>
        /// <param name="sender"></param>
        /// <param name="e"></param>
        private void dgrdData_BeforeColUpdate(object sender, BeforeColUpdateEventArgs e)
        {
            //check the input check quantity
            const string METHOD_NAME = THIS + ".dgrdData_BeforeColUpdate()";

            try
            {
                string strColumnName = e.Column.DataColumn.DataField;
                string strColumValue = e.Column.DataColumn.Text.Trim(); //dgrdData[dgrdData.Row,e.ColIndex].ToString().Trim();

                if (strColumnName == PRO_IssueMaterialDetailTable.COMMITQUANTITY_FLD)
                {
                    if (dgrdData[dgrdData.Row, PRO_IssueMaterialDetailTable.COMMITQUANTITY_FLD].ToString() != string.Empty)
                    {
                        pdecChangedQuantity = decimal.Parse(dgrdData[dgrdData.Row, PRO_IssueMaterialDetailTable.COMMITQUANTITY_FLD].ToString()) - pdecTempCommitQuantity;
                    }
                    else
                    {
                        pdecChangedQuantity = -pdecTempCommitQuantity;
                    }

                    for (int i = dgrdData.Row + 1; i < dgrdData.RowCount - 1; i++)
                    {
                        #region // HACK: DuongNA 2005-10-14

                        decimal dcmTempAvailable = 0;
                        try
                        {
                            dcmTempAvailable = decimal.Parse(dgrdData[i, AVAILABLE_QUANTITY].ToString());
                        }
                        catch
                        {
                        }
                        if ((dcmTempAvailable - pdecChangedQuantity) < 0)
                        {
                            PCSMessageBox.Show(ErrorCode.MESSAGE_RGA_LOCATION, MessageBoxIcon.Warning);
                            e.Cancel = true;
                            return;
                        }

                        #endregion // END: DuongNA 2005-10-14
                    }
                }

                //define the variable for checking the commit quantity
                decimal dcmCommitQuantity = 0;

                //Call the search form and display the result
                if (e.Column.Button)
                {
                    if (strColumValue != string.Empty)
                    {
                        DataRowView drvResult = CallOpenSearchForm(strColumnName, strColumValue, false);

                        if (drvResult != null)
                        {
                            //HACK: added by Tuan TQ. 23 Jan, 2006. From Bin must be diffirent from To Bin
                            if (strColumnName == MST_BINTable.BINID_FLD)
                            {
                                if (drvResult[MST_BINTable.BINID_FLD].Equals(txtToBin.Tag) && (txtToBin.Tag.ToString() != string.Empty))
                                {
                                    PCSMessageBox.Show(ErrorCode.MESSAGE_LOCTOLOC_DIFFERENCE_BIN, MessageBoxIcon.Warning);
                                    e.Column.DataColumn.Tag = null;
                                    e.Cancel = true;
                                }
                            }
                            //End hack

                            e.Column.DataColumn.Tag = drvResult;
                        }
                        else
                        {
                            e.Cancel = true;
                        }
                    }
                    else
                    {
                        e.Column.DataColumn.Tag = null;
                    }
                }
                else
                {
                    //check the quantity, complete percent, and all the other columns
                    if (strColumValue == string.Empty)
                        return;

                    switch (strColumnName)
                    {
                        case PRO_IssueMaterialDetailTable.COMMITQUANTITY_FLD:
                            if (!FormControlComponents.IsPositiveNumeric(strColumValue))
                            {
                                PCSMessageBox.Show(ErrorCode.MSG_LABORTIME_QTY, MessageBoxIcon.Warning);
                                e.Cancel = true;
                                break;
                            }

                            //check if this value is available in the Inventory
                            dcmCommitQuantity = decimal.Parse(strColumValue);

                            #region // HACK: DuongNA 2005-10-14

                            //count for total Commit Quantity at another rows
                            for (int i = 0; i < dgrdData.RowCount; i++)
                            {
                                //Check if the row have same ProductID, LocationID and BinID with current row
                                if ((!dgrdData[i, PRO_IssueMaterialDetailTable.BINID_FLD].Equals(dgrdData[dgrdData.Row, PRO_IssueMaterialDetailTable.BINID_FLD])) ||
                                    (!dgrdData[i, PRO_IssueMaterialDetailTable.LOCATIONID_FLD].Equals(dgrdData[dgrdData.Row, PRO_IssueMaterialDetailTable.LOCATIONID_FLD])) ||
                                    (!dgrdData[i, PRO_IssueMaterialDetailTable.PRODUCTID_FLD].Equals(dgrdData[dgrdData.Row, PRO_IssueMaterialDetailTable.PRODUCTID_FLD])) ||
                                    (i == dgrdData.Row))
                                {
                                    continue;
                                }
                                try
                                {
                                    dcmCommitQuantity += decimal.Parse(dgrdData[i, PRO_IssueMaterialDetailTable.COMMITQUANTITY_FLD].ToString());
                                }
                                catch
                                {
                                }
                            }

                            #endregion // END: DuongNA 2005-10-14

                            decimal decRemainComit = 0;
                            try
                            {
                                decRemainComit = Convert.ToDecimal(dgrdData[dgrdData.Row, Constants.RemainNeededQuantity_COL]);
                            }
                            catch { }
                            if (dcmCommitQuantity > decRemainComit)
                            {
                                string[] strMsg = new string[] { "0", decRemainComit.ToString() };
                                PCSMessageBox.Show(ErrorCode.MESSAGE_NUMBER_MUST_IN_SCOPE, MessageBoxIcon.Information, strMsg);
                                e.Cancel = true;
                            }
                            break;
                    }
                }
            }
            catch (PCSException ex)
            {
                // displays the error message.
                PCSMessageBox.Show(ex.mCode, MessageBoxIcon.Error);
                // log message.
                try
                {
                    Logger.LogMessage(ex.CauseException, METHOD_NAME, Level.ERROR);
                }
                catch
                {
                    PCSMessageBox.Show(ErrorCode.LOG_EXCEPTION, MessageBoxIcon.Error);
                }
                e.Cancel = true;
            }

            catch (Exception ex)
            {
                e.Cancel = true;
                // displays the error message.
                PCSMessageBox.Show(ErrorCode.OTHER_ERROR, MessageBoxIcon.Error);
                // log message.
                try
                {
                    Logger.LogMessage(ex, METHOD_NAME, Level.ERROR);
                }
                catch
                {
                    PCSMessageBox.Show(ErrorCode.LOG_EXCEPTION, MessageBoxIcon.Error);
                }
            }
        }

        /// <summary>
        /// Open the Search form when user click at the button
        /// </summary>
        /// <param name="sender"></param>
        /// <param name="e"></param>
        private void dgrdData_ButtonClick(object sender, ColEventArgs e)
        {
            const string METHOD_NAME = THIS + ".dgrdData_ButtonClick()";
            try
            {
                if (!dgrdData.AllowAddNew && !dgrdData.AllowUpdate)
                {
                    return;
                }
                string strColumnName = e.Column.DataColumn.DataField;
                string strColumnValue = dgrdData[dgrdData.Row, strColumnName].ToString().Trim();

                if (strColumnName != PRO_IssueMaterialDetailTable.QASTATUS_FLD)
                {
                    DisplaySearchForm(strColumnName, strColumnValue, true);
                }
            }
            catch (PCSException ex)
            {
                // displays the error message.
                PCSMessageBox.Show(ex.mCode, MessageBoxIcon.Error);
                // log message.
                try
                {
                    Logger.LogMessage(ex.CauseException, METHOD_NAME, Level.ERROR);
                }
                catch
                {
                    PCSMessageBox.Show(ErrorCode.LOG_EXCEPTION, MessageBoxIcon.Error);
                }
            }

            catch (Exception ex)
            {
                // displays the error message.
                PCSMessageBox.Show(ErrorCode.OTHER_ERROR, MessageBoxIcon.Error);
                // log message.
                try
                {
                    Logger.LogMessage(ex, METHOD_NAME, Level.ERROR);
                }
                catch
                {
                    PCSMessageBox.Show(ErrorCode.LOG_EXCEPTION, MessageBoxIcon.Error);
                }
            }
        }

        /// <summary>
        /// Implement the F4 
        /// When user press this key, it will display the Search Form 
        /// for selecting values 
        /// </summary>
        /// <param name="sender"></param>
        /// <param name="e"></param>
        private void dgrdData_KeyDown(object sender, KeyEventArgs e)
        {
            const string METHOD_NAME = THIS + ".dgrdData_KeyDown()";
            try
            {
                if ((e.KeyCode == Keys.Delete) && (dgrdData.SelectedRows.Count > 0))
                {
                    if (btnSave.Enabled)
                    {
                        FormControlComponents.DeleteMultiRowsOnTrueDBGrid(dgrdData);
                        //Re-Calculate Line column
                        ChangeLineNumber();
                    }
                }
                if (e.KeyCode == Keys.F4)
                {
                    //first get the column name
                    string strColumName = dgrdData.Columns[dgrdData.Col].DataField;
                    string strColumnValue = dgrdData.Columns[dgrdData.Col].Text;
                    if (strColumName != WORKORDERNO_COL
                        && strColumName != WORKORDERLINE_COL
                        && strColumName != LOCATIONCODE_COL
                        && strColumName != BINCODE_COL
                        && strColumName != PRODUCTCODE_COL
                        && strColumName != PRO_IssueMaterialDetailTable.LOT_FLD)
                    {
                        return;
                    }
                    DisplaySearchForm(strColumName, strColumnValue, true);
                }
            }
            catch (Exception ex)
            {
                // displays the error message.
                PCSMessageBox.Show(ErrorCode.OTHER_ERROR, MessageBoxIcon.Error);
                // log message.
                try
                {
                    Logger.LogMessage(ex, METHOD_NAME, Level.ERROR);
                }
                catch
                {
                    PCSMessageBox.Show(ErrorCode.LOG_EXCEPTION, MessageBoxIcon.Error);
                }
            }
        }

        /// <summary>
        /// After column update
        /// we need to update to the other related column
        /// its data for the related column are stored in the Tag object of the column
        /// </summary>
        /// <param name="sender"></param>
        /// <param name="e"></param>
        private void dgrdData_AfterColUpdate(object sender, ColEventArgs e)
        {
            const string METHOD_NAME = THIS + ".dgrdData_AfterColUpdate()";
            try
            {
                string strColumnName = e.Column.DataColumn.DataField;
                string strColumnValue = e.Column.DataColumn.Text.Trim();
                if (e.Column.DataColumn.Tag != null)
                {
                    UpdateValueAfterSearch(strColumnName, strColumnValue, (DataRowView)e.Column.DataColumn.Tag, false);
                }
                else
                {
                    UpdateValueAfterSearch(strColumnName, strColumnValue, null, false);
                }


                dgrdData.Refresh();
            }
            catch (PCSException ex)
            {
                // displays the error message.
                PCSMessageBox.Show(ex.mCode, MessageBoxIcon.Error);
                // log message.
                try
                {
                    Logger.LogMessage(ex.CauseException, METHOD_NAME, Level.ERROR);
                }
                catch
                {
                    PCSMessageBox.Show(ErrorCode.LOG_EXCEPTION, MessageBoxIcon.Error);
                }
            }

            catch (Exception ex)
            {
                // displays the error message.
                PCSMessageBox.Show(ErrorCode.OTHER_ERROR, MessageBoxButtons.OK, MessageBoxIcon.Error);
                // log message.
                try
                {
                    Logger.LogMessage(ex, METHOD_NAME, Level.ERROR);
                }
                catch
                {
                    PCSMessageBox.Show(ErrorCode.LOG_EXCEPTION, MessageBoxButtons.OK, MessageBoxIcon.Error);
                }
            }
        }

        /// <summary>
        /// This method is used to check if user can edit the column value
        /// For the related columns together, if user want to enter data
        /// the other column must have data first
        /// </summary>
        /// <param name="sender"></param>
        /// <param name="e"></param>
        /// <authors>
        /// THIENHD
        /// </authors>
        private void dgrdData_BeforeColEdit(object sender, BeforeColEditEventArgs e)
        {
            const string METHOD_NAME = THIS + ".dgrdData_BeforeColEdit()";
            try
            {
                string strColumnName = e.Column.DataColumn.DataField;
                if (strColumnName == PRO_IssueMaterialDetailTable.COMMITQUANTITY_FLD)
                {
                    if (dgrdData[dgrdData.Row, PRO_IssueMaterialDetailTable.COMMITQUANTITY_FLD].ToString() != string.Empty)
                    {
                        pdecTempCommitQuantity = Decimal.Parse(dgrdData[dgrdData.Row, PRO_IssueMaterialDetailTable.COMMITQUANTITY_FLD].ToString());
                    }
                    else
                    {
                        pdecTempCommitQuantity = 0;
                    }
                }

                switch (strColumnName)
                {
                    case WORKORDERNO_COL:
                        if (issueMaterialMaster.MasterLocationID <= 0)
                        {
                            //MessageBox.Show("Please select the master location first");
                            PCSMessageBox.Show(ErrorCode.MSG_LABORTIME_SELECTMASLOC, MessageBoxIcon.Warning);
                            e.Cancel = true;
                        }
                        break;

                    case WORKORDERLINE_COL:
                        if (dgrdData[dgrdData.Row, PRO_IssueMaterialDetailTable.WORKORDERMASTERID_FLD] == DBNull.Value
                            || dgrdData[dgrdData.Row, PRO_IssueMaterialDetailTable.WORKORDERMASTERID_FLD].ToString().Trim() == string.Empty)
                        {
                            //MessageBox.Show("Please select the Work Order master first");
                            PCSMessageBox.Show(ErrorCode.MSG_LABORTIME_SELECTWOMASTER, MessageBoxIcon.Warning);
                            e.Cancel = true;
                        }
                        break;

                    case LOCATIONCODE_COL:
                        if (issueMaterialMaster.MasterLocationID <= 0)
                        {
                            //MessageBox.Show("Please select the master location first");
                            PCSMessageBox.Show(ErrorCode.MSG_LABORTIME_SELECTMASLOC, MessageBoxIcon.Warning);
                            e.Cancel = true;
                        }
                        break;

                    case BINCODE_COL:
                        if (dgrdData[dgrdData.Row, HASBIN].ToString() == 1.ToString())
                        {
                            if (dgrdData[dgrdData.Row, PRO_IssueMaterialDetailTable.LOCATIONID_FLD] == DBNull.Value
                                || dgrdData[dgrdData.Row, PRO_IssueMaterialDetailTable.LOCATIONID_FLD].ToString().Trim() == string.Empty)
                            {
                                //MessageBox.Show("Please select the location first");
                                PCSMessageBox.Show(ErrorCode.MSG_WOISSUE_MATERIAL_SELECT_LOCATION_FIRST, MessageBoxIcon.Warning);
                                e.Cancel = true;
                            }
                        }
                        else
                        {
                            e.Cancel = true;
                        }
                        break;

                    case PRODUCTCODE_COL:
                        if (dgrdData[dgrdData.Row, PRO_IssueMaterialDetailTable.WORKORDERDETAILID_FLD] == DBNull.Value
                            || dgrdData[dgrdData.Row, PRO_IssueMaterialDetailTable.WORKORDERDETAILID_FLD].ToString().Trim() == string.Empty)
                        {
                            //MessageBox.Show("Please select the work order line first");
                            PCSMessageBox.Show(ErrorCode.MSG_WOISSUE_MATERIAL_SELECT_WORKORDER_LINE_FIRST, MessageBoxIcon.Warning);
                            e.Cancel = true;
                        }
                        break;

                    case PRODUCTDESC_COL:
                        if (dgrdData[dgrdData.Row, PRO_IssueMaterialDetailTable.WORKORDERDETAILID_FLD] == DBNull.Value
                            || dgrdData[dgrdData.Row, PRO_IssueMaterialDetailTable.WORKORDERDETAILID_FLD].ToString().Trim() == string.Empty)
                        {
                            //MessageBox.Show("Please select the work order line first");
                            PCSMessageBox.Show(ErrorCode.MSG_WOISSUE_MATERIAL_SELECT_WORKORDER_LINE_FIRST, MessageBoxIcon.Warning);
                            e.Cancel = true;
                        }
                        break;

                    case PRODUCTREVISION_COL:
                        if (dgrdData[dgrdData.Row, PRO_IssueMaterialDetailTable.WORKORDERDETAILID_FLD] == DBNull.Value
                            || dgrdData[dgrdData.Row, PRO_IssueMaterialDetailTable.WORKORDERDETAILID_FLD].ToString().Trim() == string.Empty)
                        {
                            //MessageBox.Show("Please select the work order line first");
                            PCSMessageBox.Show(ErrorCode.MSG_WOISSUE_MATERIAL_SELECT_WORKORDER_LINE_FIRST, MessageBoxIcon.Warning);
                            e.Cancel = true;
                        }
                        break;

                    case PRO_IssueMaterialDetailTable.COMMITQUANTITY_FLD:
                        if (dgrdData[dgrdData.Row, PRO_IssueMaterialDetailTable.PRODUCTID_FLD] == DBNull.Value
                            || dgrdData[dgrdData.Row, PRO_IssueMaterialDetailTable.PRODUCTID_FLD].ToString().Trim() == string.Empty)
                        {
                            //MessageBox.Show("Please select the component to issue material first");
                            PCSMessageBox.Show(ErrorCode.MSG_WOISSUE_MATERIAL_SELECT_COMPONENT_FIRST, MessageBoxIcon.Warning);
                            e.Cancel = true;
                        }
                        break;

                    case PRO_IssueMaterialDetailTable.LOT_FLD:
                        if (dgrdData[dgrdData.Row, PRO_IssueMaterialDetailTable.PRODUCTID_FLD] == DBNull.Value
                            || dgrdData[dgrdData.Row, PRO_IssueMaterialDetailTable.PRODUCTID_FLD].ToString().Trim() == string.Empty)
                        {
                            //MessageBox.Show("Please select the component to issue material first");
                            PCSMessageBox.Show(ErrorCode.MSG_WOISSUE_MATERIAL_SELECT_COMPONENT_FIRST, MessageBoxIcon.Warning);
                            e.Cancel = true;
                        }
                        break;

                    case PRO_IssueMaterialDetailTable.SERIAL_FLD:
                        if (dgrdData[dgrdData.Row, PRO_IssueMaterialDetailTable.SERIAL_FLD] == DBNull.Value
                            || dgrdData[dgrdData.Row, PRO_IssueMaterialDetailTable.SERIAL_FLD].ToString().Trim() == string.Empty)
                        {
                            //MessageBox.Show("Please select the lot first");
                            PCSMessageBox.Show(ErrorCode.MSG_WOISSUE_MATERIAL_SELECT_LOT_FIRST, MessageBoxIcon.Warning);
                            e.Cancel = true;
                        }
                        break;
                }
            }
            catch (Exception ex)
            {
                // displays the error message.
                PCSMessageBox.Show(ErrorCode.OTHER_ERROR, MessageBoxIcon.Error);
                // log message.
                try
                {
                    Logger.LogMessage(ex, METHOD_NAME, Level.ERROR);
                }
                catch
                {
                    PCSMessageBox.Show(ErrorCode.LOG_EXCEPTION, MessageBoxIcon.Error);
                }
            }
        }

        /// <summary>
        /// This method is used to set some default column values for the detail 
        /// when user add a new row into the grid
        /// </summary>
        /// <param name="sender"></param>
        /// <param name="e"></param>
        private void dgrdData_OnAddNew(object sender, EventArgs e)
        {
            //assign the master id to the detail
            const string METHOD_NAME = THIS + ".dgrdData_OnAddNew()";
            try
            {
                dgrdData[dgrdData.Row, PRO_IssueMaterialDetailTable.MASTERLOCATIONID_FLD] = issueMaterialMaster.MasterLocationID;
                dgrdData[dgrdData.Row, PRO_IssueMaterialDetailTable.LINE_FLD] = GetTheNextLineNumber();
            }
            catch (Exception ex)
            {
                // displays the error message.
                PCSMessageBox.Show(ErrorCode.OTHER_ERROR, MessageBoxIcon.Error);
                // log message.
                try
                {
                    Logger.LogMessage(ex, METHOD_NAME, Level.ERROR);
                }
                catch
                {
                    PCSMessageBox.Show(ErrorCode.LOG_EXCEPTION, MessageBoxIcon.Error);
                }
            }

        }

        /// <summary>
        /// This method is used to reset the line number after deleting
        /// a row in the grid
        /// </summary>
        /// <param name="sender"></param>
        /// <param name="e"></param>
        private void dgrdData_AfterDelete(object sender, EventArgs e)
        {
            const string METHOD_NAME = THIS + ".dgrdData_OnAddNew()";
            try
            {
                ChangeLineNumber();
            }
            catch (Exception ex)
            {
                // displays the error message.
                PCSMessageBox.Show(ErrorCode.OTHER_ERROR, MessageBoxIcon.Error);
                // log message.
                try
                {
                    Logger.LogMessage(ex, METHOD_NAME, Level.ERROR);
                }
                catch
                {
                    PCSMessageBox.Show(ErrorCode.LOG_EXCEPTION, MessageBoxIcon.Error);
                }
            }

        }
        /// <summary>
        /// btnPurpose_Click
        /// </summary>
        /// <param name="sender"></param>
        /// <param name="e"></param>
        /// <author>Trada</author>
        /// <date>Wednesday, October 26 2005</date>
        private void btnPurpose_Click(object sender, System.EventArgs e)
        {
            const string METHOD_NAME = THIS + ".btnPurpose_Click()";
            try
            {
                //HACK: added by Tuan TQ. 18 Jan, 2006. apply purpose
                Hashtable htbCondition = new Hashtable();
                int iIssueMaterialTransID = 0;
                iIssueMaterialTransID = (new UtilsBO()).GetTransTypeIDByCode(TransactionTypeEnum.PROIssueMaterial.ToString());
                htbCondition.Add(MST_TranTypeTable.TRANTYPEID_FLD, iIssueMaterialTransID);
                //End hack

                DataRowView drwResult = null;

                drwResult = FormControlComponents.OpenSearchForm(PRO_IssuePurposeTable.TABLE_NAME, PRO_IssuePurposeTable.DESCRIPTION_FLD, txtPurpose.Text.Trim(), htbCondition, true);
                if (drwResult != null)
                {
                    txtPurpose.Text = drwResult[PRO_IssuePurposeTable.DESCRIPTION_FLD].ToString();
                    txtPurpose.Tag = drwResult[PRO_IssuePurposeTable.ISSUEPURPOSEID_FLD];

                    issueMaterialMaster.IssuePurposeID = int.Parse(drwResult[PRO_IssuePurposeTable.ISSUEPURPOSEID_FLD].ToString());
                    strLastValidPurpose = txtPurpose.Text.Trim();
                }
            }
            catch (PCSException ex)
            {
                // displays the error message.
                PCSMessageBox.Show(ex.mCode, MessageBoxIcon.Error);
                // log message.
                try
                {
                    Logger.LogMessage(ex.CauseException, METHOD_NAME, Level.ERROR);
                }
                catch
                {
                    PCSMessageBox.Show(ErrorCode.LOG_EXCEPTION, MessageBoxIcon.Error);
                }
            }

            catch (Exception ex)
            {
                // displays the error message.
                PCSMessageBox.Show(ErrorCode.OTHER_ERROR, MessageBoxButtons.OK, MessageBoxIcon.Error);
                // log message.
                try
                {
                    Logger.LogMessage(ex, METHOD_NAME, Level.ERROR);
                }
                catch
                {
                    PCSMessageBox.Show(ErrorCode.LOG_EXCEPTION, MessageBoxButtons.OK, MessageBoxIcon.Error);
                }
            }
        }
        /// <summary>
        /// btnToLocation_Click
        /// </summary>
        /// <param name="sender"></param>
        /// <param name="e"></param>
        /// <author>Trada</author>
        /// <date>Wednesday, October 26 2005</date>
        private void btnToLocation_Click(object sender, System.EventArgs e)
        {
            const string METHOD_NAME = THIS + ".btnToLocation_Click()";
            try
            {
                Hashtable htbCriteria = new Hashtable();
                DataRowView drwResult = null;
                //User has entered MasLoc
                if (txtMasLoc.Text.Trim() != string.Empty)
                    htbCriteria.Add(PRO_IssueMaterialMasterTable.MASTERLOCATIONID_FLD, issueMaterialMaster.MasterLocationID);
                else //User has not entered MasLoc
                {
                    string[] msg = { lblMasLoc.Text, lblToLocation.Text };
                    PCSMessageBox.Show(ErrorCode.MESSAGE_SELECT_ONE_BEFORE_SELECT_ONE, MessageBoxIcon.Warning, msg);
                    if (txtToLocation.Text.Trim() != string.Empty)
                        txtToLocation.Focus();
                    else
                        txtMasLoc.Focus();
                    return;
                }

                //HACK: added by Tuan TQ. 19 Jan, 2006. To Location Must be Manufacturing
                htbCriteria.Add(MST_LocationTable.LOCATIONTYPEID_FLD, (int)LocationTypeEnum.Manufacturing);
                //End hack

                drwResult = FormControlComponents.OpenSearchForm(v_LocationNoScecurity.TABLE_NAME, MST_LocationTable.CODE_FLD, txtToLocation.Text.Trim(), htbCriteria, true);
                if (drwResult != null)
                {
                    //Check if Location has BinControl
                    bool blnBinControl = Convert.ToBoolean(drwResult[MST_LocationTable.BIN_FLD]);
                    txtToBin.Enabled = btnToBin.Enabled = blnBinControl;
                    txtToLocation.Text = drwResult[MST_LocationTable.CODE_FLD].ToString();
                    txtToLocation.Tag = drwResult[MST_LocationTable.LOCATIONID_FLD];
                    issueMaterialMaster.ToLocationID = int.Parse(drwResult[MST_LocationTable.LOCATIONID_FLD].ToString());
                    // change location
                    if (strLastValidLocation != txtToLocation.Text)
                    {
                        txtToBin.Text = string.Empty;
                        txtToBin.Tag = "0";
                        issueMaterialMaster.ToBinID = 0;
                        strLastValidLocation = txtToLocation.Text;
                    }
                }
            }
            catch (PCSException ex)
            {
                // displays the error message.
                PCSMessageBox.Show(ex.mCode, MessageBoxIcon.Error);
                // log message.
                try
                {
                    Logger.LogMessage(ex.CauseException, METHOD_NAME, Level.ERROR);
                }
                catch
                {
                    PCSMessageBox.Show(ErrorCode.LOG_EXCEPTION, MessageBoxIcon.Error);
                }
            }

            catch (Exception ex)
            {
                // displays the error message.
                PCSMessageBox.Show(ErrorCode.OTHER_ERROR, MessageBoxButtons.OK, MessageBoxIcon.Error);
                // log message.
                try
                {
                    Logger.LogMessage(ex, METHOD_NAME, Level.ERROR);
                }
                catch
                {
                    PCSMessageBox.Show(ErrorCode.LOG_EXCEPTION, MessageBoxButtons.OK, MessageBoxIcon.Error);
                }
            }
        }
        /// <summary>
        /// btnToBin_Click
        /// </summary>
        /// <param name="sender"></param>
        /// <param name="e"></param>
        /// <author>Trada</author>
        /// <date>Wednesday, October 26 2005</date>
        private void btnToBin_Click(object sender, System.EventArgs e)
        {
            const string METHOD_NAME = THIS + ".btnToBin_Click()";
            try
            {
                Hashtable htbCriteria = new Hashtable();
                DataRowView drwResult = null;

                //User has entered ToLocation
                if (txtToLocation.Text.Trim() != string.Empty)
                    htbCriteria.Add(MST_LocationTable.LOCATIONID_FLD, issueMaterialMaster.ToLocationID);
                else //User has not entered ToLocation
                {
                    string[] msg = { lblToLocation.Text, lblToBin.Text };
                    PCSMessageBox.Show(ErrorCode.MESSAGE_SELECT_ONE_BEFORE_SELECT_ONE, MessageBoxIcon.Warning, msg);
                    if (txtToBin.Text.Trim() != string.Empty)
                        txtToBin.Focus();
                    else
                        txtToLocation.Focus();
                    return;
                }

                //HACK: Added by Tuan TQ. 19 Jan, 2006. Tobin must be Incoming (Buffer)
                htbCriteria.Add(MST_BINTable.BINTYPEID_FLD, (int)BinTypeEnum.IN);
                //End Hacked

                drwResult = FormControlComponents.OpenSearchForm(v_BinNoSecurity.TABLE_NAME, MST_BINTable.CODE_FLD, txtToBin.Text.Trim(), htbCriteria, true);
                if (drwResult != null)
                {
                    txtToBin.Text = drwResult[MST_BINTable.CODE_FLD].ToString();
                    txtToBin.Tag = drwResult[MST_BINTable.BINID_FLD];

                    issueMaterialMaster.ToBinID = int.Parse(drwResult[MST_BINTable.BINID_FLD].ToString());

                    strLastValidBin = txtToBin.Text;
                }
            }
            catch (PCSException ex)
            {
                // displays the error message.
                PCSMessageBox.Show(ex.mCode, MessageBoxIcon.Error);
                // log message.
                try
                {
                    Logger.LogMessage(ex.CauseException, METHOD_NAME, Level.ERROR);
                }
                catch
                {
                    PCSMessageBox.Show(ErrorCode.LOG_EXCEPTION, MessageBoxIcon.Error);
                }
            }

            catch (Exception ex)
            {
                // displays the error message.
                PCSMessageBox.Show(ErrorCode.OTHER_ERROR, MessageBoxButtons.OK, MessageBoxIcon.Error);
                // log message.
                try
                {
                    Logger.LogMessage(ex, METHOD_NAME, Level.ERROR);
                }
                catch
                {
                    PCSMessageBox.Show(ErrorCode.LOG_EXCEPTION, MessageBoxButtons.OK, MessageBoxIcon.Error);
                }
            }
        }
        /// <summary>
        /// txtPurpose_KeyDown
        /// </summary>
        /// <param name="sender"></param>
        /// <param name="e"></param>
        /// <author>Trada</author>
        /// <date>Wednesday, October 26 2005</date>
        private void txtPurpose_KeyDown(object sender, System.Windows.Forms.KeyEventArgs e)
        {
            if (e.KeyCode == Keys.F4)
            {
                if (btnPurpose.Enabled)
                {
                    btnPurpose_Click(null, null);
                }
            }
        }
        /// <summary>
        /// txtToLocation_KeyDown
        /// </summary>
        /// <param name="sender"></param>
        /// <param name="e"></param>
        /// <author>Trada</author>
        /// <date>Wednesday, October 26 2005</date>
        private void txtToLocation_KeyDown(object sender, System.Windows.Forms.KeyEventArgs e)
        {
            if (e.KeyCode == Keys.F4)
            {
                if (btnToLocation.Enabled)
                {
                    btnToLocation_Click(null, null);
                }
            }
        }

        /// <summary>
        /// Thachnn: 27/10/2005
        /// Preview the report for this form
        /// Using the "Issue Slip.xml" layout
        /// </summary>
        /// <param name="sender"></param>
        /// <param name="e"></param>
        private void btnPrintIssueSlip_Click(object sender, System.EventArgs e)
        {
            #region Constants
            const string METHOD_NAME = THIS + ".txtToLocation_KeyDown()";
            string mstrReportDefFolder = Application.StartupPath + "\\" + Constants.REPORT_DEFINITION_STORE_LOCATION;
            const string REPORT_LAYOUT_FILE = "IssueSlip.xml";
            const string REPORT_NAME = "Issue Slip";

            const string REPORTFLD_COMPANY = "fldCompany";
            const string REPORTFLD_ADDRESS = "fldAddress";
            const string REPORTFLD_TEL = "fldTel";
            const string REPORTFLD_FAX = "fldFax";

            const string REPORTFLD_SLIPNO = "fldSlipNo";
            const string REPORTFLD_POSTDATE = "fldPostDate";
            const string REPORTFLD_POSTTIME = "fldPostTime";
            const string REPORTFLD_WORKORDERNO = "fldWorkOrderNo";
            const string REPORTFLD_LINENO = "fldLineNo";
            const string REPORTFLD_CATEGORYCODE = "fldCategoryCode";
            const string REPORTFLD_CATEGORYNAME = "fldCategoryName";
            const string REPORTFLD_CATEGORYMODEL = "fldCategoryModel";
            const string REPORTFLD_PURPOSE = "fldPurpose";

            const string REPORTFLD_FROMLOCATIONNAME = "fldFromLocationName";
            const string REPORTFLD_FROMLOCATIONCODE = "fldFromLocationCode";
            const string REPORTFLD_TOLOCATIONNAME = "fldToLocationName";
            const string REPORTFLD_TOLOCATIONCODE = "fldToLocationCode";

            const string REPORTFLD_PARTNUMBER = "fldPartNumber";
            const string REPORTFLD_PARTNAME = "fldPartName";
            const string REPORTFLD_UNIT = "fldUnit";
            const string REPORTFLD_QTYACTUAL = "fldQtyActual";
            const string REPORTFLD_SOURCE = "fldSource";
            const string REPORTFLD_QTYPLAN = "fldQtyPlan";

            #endregion

            MultiWOIssueMaterialBO objBO = new MultiWOIssueMaterialBO();
            DataTable dtbResult;

            try
            {
                dtbResult = this.dstData.Tables[0].Copy();
            }
            catch
            {
                dtbResult = new DataTable();
            }

            ArrayList arrWOLines = GetColumnValuesFromTable(dtbResult, WORKORDERLINE_COL);
            ArrayList arrWONumbers = GetColumnValuesFromTable(dtbResult, WORKORDERNO_COL);
            if (arrWOLines.Count > 1 || arrWONumbers.Count > 1)
            {
                MessageBox.Show("This report can only run with 1 Work Order and it has only 1 Line");
                return;
            }

            Cursor = Cursors.WaitCursor;

            try
            {
                ReportBuilder objRB;
                objRB = new ReportBuilder();
                try
                {
                    objRB.ReportName = REPORT_NAME;
                    objRB.SourceDataTable = dtbResult;
                }
                catch
                {
                    return;
                }

                #region BUILD ISSUE SLIP REPORT FIELD
                try
                {
                    objRB.ReportDefinitionFolder = mstrReportDefFolder;
                    objRB.ReportLayoutFile = REPORT_LAYOUT_FILE;
                    objRB.UseLayoutFile = objRB.AnalyseLayoutFile();
                }
                catch
                {
                    objRB.UseLayoutFile = false;
                    PCSMessageBox.Show(ErrorCode.MESSAGE_REPORT_TEMPLATE_FILE_NOT_FOUND);
                }
                #endregion

                objRB.MakeDataTableForRender();

                #region RENDER TO PRINT PREVIEW
                // and show it in preview dialog				
                PCSUtils.Framework.ReportFrame.C1PrintPreviewDialog printPreview = new PCSUtils.Framework.ReportFrame.C1PrintPreviewDialog();

                objRB.ReportViewer = printPreview.ReportViewer;
                objRB.RenderReport();



                #region COMPANY INFO // header information get from system params
                try
                {
                    objRB.DrawPredefinedField(REPORTFLD_COMPANY, SystemProperty.SytemParams.Get(SystemParam.COMPANY_FULL_NAME));
                }
                catch { }
                try
                {
                    objRB.DrawPredefinedField(REPORTFLD_ADDRESS, SystemProperty.SytemParams.Get(SystemParam.ADDRESS));
                }
                catch { }
                try
                {
                    objRB.DrawPredefinedField(REPORTFLD_TEL, SystemProperty.SytemParams.Get(SystemParam.TEL));
                }
                catch { }
                try
                {
                    objRB.DrawPredefinedField(REPORTFLD_FAX, SystemProperty.SytemParams.Get(SystemParam.FAX));
                }
                catch { }
                #endregion


                if (issueMaterialMaster != null && dtbResult.Rows.Count > 0)
                {
                    try
                    {
                        objRB.DrawPredefinedField(REPORTFLD_SLIPNO, issueMaterialMaster.IssueNo);
                    }
                    catch { }

                    try
                    {
                        objRB.DrawPredefinedField(REPORTFLD_POSTDATE, issueMaterialMaster.PostDate.ToLongDateString());
                    }
                    catch { }
                    try
                    {
                        objRB.DrawPredefinedField(REPORTFLD_POSTTIME, issueMaterialMaster.PostDate.ToShortTimeString());
                    }
                    catch { }

                    try
                    {
                        string strWorkOrderNo = dtbResult.Rows[0][WORKORDERNO_COL].ToString();
                        objRB.DrawPredefinedField(REPORTFLD_WORKORDERNO, strWorkOrderNo);
                    }
                    catch { }

                    try
                    {
                        string strLineNo = dtbResult.Rows[0][WORKORDERLINE_COL].ToString();
                        objRB.DrawPredefinedField(REPORTFLD_LINENO, strLineNo);
                    }
                    catch { }

                    try
                    {
                        PCSComUtils.Framework.ReportFrame.BO.C1PrintPreviewDialogBO objReportBO = new PCSComUtils.Framework.ReportFrame.BO.C1PrintPreviewDialogBO();
                        int nLine = int.Parse(dtbResult.Rows[0][WORKORDERLINE_COL].ToString());
                        string strWorkOrderNo = dtbResult.Rows[0][WORKORDERNO_COL].ToString();
                        objRB.DrawPredefinedField(REPORTFLD_CATEGORYCODE, objReportBO.GetCategoryCodeFromLineAndWorkOrderNo(nLine, strWorkOrderNo));
                        objRB.DrawPredefinedField(REPORTFLD_CATEGORYNAME, objReportBO.GetCategoryNameFromLineAndWorkOrderNo(nLine, strWorkOrderNo));
                        objRB.DrawPredefinedField(REPORTFLD_CATEGORYMODEL, objReportBO.GetProductModelFromLineAndWorkOrderNo(nLine, strWorkOrderNo));
                    }
                    catch { }

                    objRB.DrawPredefinedField(REPORTFLD_PURPOSE, txtPurpose.Text);

                    try
                    {
                        string strFromLocationCode = dtbResult.Rows[0][LOCATIONCODE_COL].ToString();
                        objRB.DrawPredefinedField(REPORTFLD_FROMLOCATIONCODE, strFromLocationCode);

                        string strFromLocationName = objBO.GetLocationNameByLocationCode(strFromLocationCode);
                        objRB.DrawPredefinedField(REPORTFLD_FROMLOCATIONNAME, strFromLocationName);
                    }
                    catch { }

                    try
                    {
                        objRB.DrawPredefinedField(REPORTFLD_TOLOCATIONCODE, txtToLocation.Text);// ToLocationCode);					

                        string strToLocationName = objBO.GetLocationNameByLocationCode(txtToLocation.Text);
                        objRB.DrawPredefinedField(REPORTFLD_TOLOCATIONNAME, strToLocationName);
                    }
                    catch { }
                }

                objRB.DrawPredefinedField(REPORTFLD_PARTNUMBER, PRODUCTCODE_COL);
                objRB.DrawPredefinedField(REPORTFLD_PARTNAME, PRODUCTDESC_COL);
                objRB.DrawPredefinedField(REPORTFLD_UNIT, UNITCODE_COL);
                objRB.DrawPredefinedField(REPORTFLD_QTYACTUAL, COMMITQUANTITY_COL);
                objRB.DrawPredefinedField(REPORTFLD_SOURCE, LOT_COL);
                objRB.DrawPredefinedField(REPORTFLD_QTYPLAN, NEEDEDQUANTITY_COL);

                objRB.RefreshReport();

                try
                {
                    printPreview.FormTitle = objRB.GetFieldByName(REPORTFLD_TITLE).Text;
                }
                catch { }
                printPreview.Show();
                this.Cursor = Cursors.Default;

                #endregion
            }
            catch (Exception ex)
            {
                PCSMessageBox.Show(ErrorCode.OTHER_ERROR);
                // log message.
                try
                {
                    Logger.LogMessage(ex, METHOD_NAME, Level.ERROR);
                }
                catch
                {
                    PCSMessageBox.Show(ErrorCode.LOG_EXCEPTION, MessageBoxButtons.OK, MessageBoxIcon.Error);
                }
            }
            finally
            {
                Cursor = Cursors.Default;
            }
        }

        /// <summary>
        /// txtToBin_KeyDown
        /// </summary>
        /// <param name="sender"></param>
        /// <param name="e"></param>
        /// <author>Trada</author>
        /// <date>Wednesday, October 26 2005</date>
        private void txtToBin_KeyDown(object sender, System.Windows.Forms.KeyEventArgs e)
        {
            if (e.KeyCode == Keys.F4)
            {
                if (btnToBin.Enabled)
                {
                    btnToBin_Click(null, null);
                }
            }
        }
        /// <summary>
        /// txtPurpose_Validating
        /// </summary>
        /// <param name="sender"></param>
        /// <param name="e"></param>
        /// <author>Trada</author>
        /// <date>Wednesday, October 26 2005</date>
        private void txtPurpose_Validating(object sender, System.ComponentModel.CancelEventArgs e)
        {
            const string METHOD_NAME = THIS + ".txtPurpose_Validating()";
            try
            {
                if (txtPurpose.Text.Trim() == string.Empty)
                {
                    txtPurpose.Tag = "0";
                    issueMaterialMaster.IssuePurposeID = 0;
                    strLastValidPurpose = string.Empty;
                    return;
                }

                if (strLastValidPurpose == txtPurpose.Text.Trim()) return;

                //HACK: added by Tuan TQ. 18 Jan, 2006. apply purpose
                Hashtable htbCondition = new Hashtable();
                int iIssueMaterialTransID = 0;
                iIssueMaterialTransID = (new UtilsBO()).GetTransTypeIDByCode(TransactionTypeEnum.PROIssueMaterial.ToString());
                htbCondition.Add(MST_TranTypeTable.TRANTYPEID_FLD, iIssueMaterialTransID);
                //End hack

                DataRowView drwResult = null;
                drwResult = FormControlComponents.OpenSearchForm(PRO_IssuePurposeTable.TABLE_NAME, PRO_IssuePurposeTable.DESCRIPTION_FLD, txtPurpose.Text.Trim(), htbCondition, false);
                if (drwResult != null)
                {
                    txtPurpose.Text = drwResult[PRO_IssuePurposeTable.DESCRIPTION_FLD].ToString();
                    txtPurpose.Tag = drwResult[PRO_IssuePurposeTable.ISSUEPURPOSEID_FLD];

                    issueMaterialMaster.IssuePurposeID = int.Parse(drwResult[PRO_IssuePurposeTable.ISSUEPURPOSEID_FLD].ToString());

                    strLastValidPurpose = txtPurpose.Text.Trim();
                }
                else
                    e.Cancel = true;
            }
            catch (PCSException ex)
            {
                // displays the error message.
                PCSMessageBox.Show(ex.mCode, MessageBoxIcon.Error);
                // log message.
                try
                {
                    Logger.LogMessage(ex.CauseException, METHOD_NAME, Level.ERROR);
                }
                catch
                {
                    PCSMessageBox.Show(ErrorCode.LOG_EXCEPTION, MessageBoxIcon.Error);
                }
            }

            catch (Exception ex)
            {
                // displays the error message.
                PCSMessageBox.Show(ErrorCode.OTHER_ERROR, MessageBoxButtons.OK, MessageBoxIcon.Error);
                // log message.
                try
                {
                    Logger.LogMessage(ex, METHOD_NAME, Level.ERROR);
                }
                catch
                {
                    PCSMessageBox.Show(ErrorCode.LOG_EXCEPTION, MessageBoxButtons.OK, MessageBoxIcon.Error);
                }
            }
        }
        /// <summary>
        /// txtToLocation_Validating
        /// </summary>
        /// <param name="sender"></param>
        /// <param name="e"></param>
        /// <author>Trada</author>
        /// <date>Wednesday, October 26 2005</date>
        private void txtToLocation_Validating(object sender, System.ComponentModel.CancelEventArgs e)
        {
            const string METHOD_NAME = THIS + ".txtToLocation_Validating()";
            try
            {
                if (txtToLocation.Text.Trim() == string.Empty)
                {
                    txtToLocation.Tag = "0";
                    txtToBin.Text = string.Empty;
                    txtToBin.Tag = "0";
                    issueMaterialMaster.ToBinID = 0;
                    strLastValidLocation = string.Empty;
                    return;
                }

                if (strLastValidLocation == txtToLocation.Text.Trim()) return;

                Hashtable htbCriteria = new Hashtable();
                DataRowView drwResult = null;
                //User has entered MasLoc
                if (txtMasLoc.Text.Trim() != string.Empty)
                    htbCriteria.Add(PRO_IssueMaterialMasterTable.MASTERLOCATIONID_FLD, issueMaterialMaster.MasterLocationID);
                else //User has not entered MasLoc
                {
                    string[] msg = { lblMasLoc.Text, lblToLocation.Text };
                    PCSMessageBox.Show(ErrorCode.MESSAGE_SELECT_ONE_BEFORE_SELECT_ONE, MessageBoxIcon.Warning, msg);
                    e.Cancel = true;
                    return;
                }

                //HACK: added by Tuan TQ. 19 Jan, 2006. To Location Must be Manufacturing
                htbCriteria.Add(MST_LocationTable.LOCATIONTYPEID_FLD, (int)LocationTypeEnum.Manufacturing);
                //End hack

                drwResult = FormControlComponents.OpenSearchForm(v_LocationNoScecurity.TABLE_NAME, MST_LocationTable.CODE_FLD, txtToLocation.Text.Trim(), htbCriteria, false);
                if (drwResult != null)
                {
                    txtToBin.Enabled = btnToBin.Enabled = Convert.ToBoolean(drwResult[MST_LocationTable.BIN_FLD]);

                    txtToLocation.Text = drwResult[MST_LocationTable.CODE_FLD].ToString();
                    txtToLocation.Tag = drwResult[MST_LocationTable.LOCATIONID_FLD];

                    issueMaterialMaster.ToLocationID = int.Parse(drwResult[MST_LocationTable.LOCATIONID_FLD].ToString());

                    if (strLastValidLocation != txtToLocation.Text)
                    {
                        txtToBin.Text = string.Empty;
                        txtToBin.Tag = "0";
                        issueMaterialMaster.ToBinID = 0;
                        strLastValidLocation = txtToLocation.Text;
                    }
                }
                else
                    e.Cancel = true;
            }
            catch (PCSException ex)
            {
                // displays the error message.
                PCSMessageBox.Show(ex.mCode, MessageBoxIcon.Error);
                // log message.
                try
                {
                    Logger.LogMessage(ex.CauseException, METHOD_NAME, Level.ERROR);
                }
                catch
                {
                    PCSMessageBox.Show(ErrorCode.LOG_EXCEPTION, MessageBoxIcon.Error);
                }
            }

            catch (Exception ex)
            {
                // displays the error message.
                PCSMessageBox.Show(ErrorCode.OTHER_ERROR, MessageBoxButtons.OK, MessageBoxIcon.Error);
                // log message.
                try
                {
                    Logger.LogMessage(ex, METHOD_NAME, Level.ERROR);
                }
                catch
                {
                    PCSMessageBox.Show(ErrorCode.LOG_EXCEPTION, MessageBoxButtons.OK, MessageBoxIcon.Error);
                }
            }
        }
        /// <summary>
        /// txtToBin_Validating
        /// </summary>
        /// <param name="sender"></param>
        /// <param name="e"></param>
        /// <author>Trada</author>
        /// <date>Wednesday, October 26 2005</date>
        private void txtToBin_Validating(object sender, System.ComponentModel.CancelEventArgs e)
        {
            const string METHOD_NAME = THIS + ".txtToBin_Validating()";
            try
            {
                if (txtToBin.Text.Trim() == string.Empty)
                {
                    txtToBin.Tag = "0";
                    strLastValidBin = string.Empty;
                    return;
                }

                if (strLastValidBin == txtToBin.Text.Trim()) return;

                Hashtable htbCriteria = new Hashtable();
                DataRowView drwResult = null;

                //User has entered ToLocation
                if (txtToLocation.Text.Trim() != string.Empty)
                    htbCriteria.Add(MST_LocationTable.LOCATIONID_FLD, issueMaterialMaster.ToLocationID);
                else //User has not entered ToLocation
                {
                    string[] msg = { lblToLocation.Text, lblToBin.Text };
                    PCSMessageBox.Show(ErrorCode.MESSAGE_SELECT_ONE_BEFORE_SELECT_ONE, MessageBoxIcon.Warning, msg);
                    e.Cancel = true;
                    return;
                }

                //HACK: Added by Tuan TQ. 19 Jan, 2006. Tobin must be Incoming
                htbCriteria.Add(MST_BINTable.BINTYPEID_FLD, (int)BinTypeEnum.IN);
                //End Hacked

                drwResult = FormControlComponents.OpenSearchForm(v_BinNoSecurity.TABLE_NAME, MST_BINTable.CODE_FLD, txtToBin.Text.Trim(), htbCriteria, false);
                if (drwResult != null)
                {
                    txtToBin.Text = drwResult[MST_BINTable.CODE_FLD].ToString();
                    txtToBin.Tag = drwResult[MST_BINTable.BINID_FLD];

                    issueMaterialMaster.ToBinID = int.Parse(drwResult[MST_BINTable.BINID_FLD].ToString());

                    strLastValidBin = txtToBin.Text;
                }
                else
                    e.Cancel = true;
            }
            catch (PCSException ex)
            {
                // displays the error message.
                PCSMessageBox.Show(ex.mCode, MessageBoxIcon.Error);
                // log message.
                try
                {
                    Logger.LogMessage(ex.CauseException, METHOD_NAME, Level.ERROR);
                }
                catch
                {
                    PCSMessageBox.Show(ErrorCode.LOG_EXCEPTION, MessageBoxIcon.Error);
                }
            }

            catch (Exception ex)
            {
                // displays the error message.
                PCSMessageBox.Show(ErrorCode.OTHER_ERROR, MessageBoxButtons.OK, MessageBoxIcon.Error);
                // log message.
                try
                {
                    Logger.LogMessage(ex, METHOD_NAME, Level.ERROR);
                }
                catch
                {
                    PCSMessageBox.Show(ErrorCode.LOG_EXCEPTION, MessageBoxButtons.OK, MessageBoxIcon.Error);
                }
            }
        }

        /// <summary>
        /// Thachnn : 15/Oct/2005
        /// Browse the DataTable, get all value of column with provided named.
        /// </summary>
        /// <param name="pdtb">DataTable to collect values</param>
        /// <param name="pstrColumnName">COlumn Name in pdtb DataTable to collect values from</param>
        /// <returns>ArrayList of object, collect from pdtb's column named pstrColumnName. Empty ArrayList if error or not found any row in pdtb.</returns>
        private ArrayList GetColumnValuesFromTable(DataTable pdtb, string pstrColumnName)
        {
            ArrayList arrRet = new ArrayList();
            try
            {
                foreach (DataRow drow in pdtb.Rows)
                {
                    object objGet = drow[pstrColumnName];
                    if (!arrRet.Contains(objGet))
                    {
                        arrRet.Add(objGet);
                    }
                }
            }
            catch
            {
                arrRet.Clear();
            }
            return arrRet;
        }
        /// <summary>
        /// btnShift_Click
        /// </summary>
        /// <param name="sender"></param>
        /// <param name="e"></param>
        /// <author>Trada</author>
        /// <date>Wednesday, Nov 30 2005</date>
        private void btnShift_Click(object sender, System.EventArgs e)
        {
            const string METHOD_NAME = THIS + ".btnShift_Click()";
            try
            {
                DataRowView drwResult = null;
                drwResult = FormControlComponents.OpenSearchForm(PRO_ShiftTable.TABLE_NAME, PRO_ShiftTable.SHIFTDESC_FLD, txtShift.Text.Trim(), null, true);
                if (drwResult != null)
                {
                    txtShift.Tag = drwResult[PRO_ShiftTable.SHIFTID_FLD];
                    txtShift.Text = drwResult[PRO_ShiftTable.SHIFTDESC_FLD].ToString();
                    strLastValidShift = txtShift.Text;
                }
            }
            catch (PCSException ex)
            {
                // displays the error message.
                PCSMessageBox.Show(ex.mCode, MessageBoxIcon.Error);
                // log message.
                try
                {
                    Logger.LogMessage(ex.CauseException, METHOD_NAME, Level.ERROR);
                }
                catch
                {
                    PCSMessageBox.Show(ErrorCode.LOG_EXCEPTION, MessageBoxIcon.Error);
                }
            }

            catch (Exception ex)
            {
                // displays the error message.
                PCSMessageBox.Show(ErrorCode.OTHER_ERROR, MessageBoxButtons.OK, MessageBoxIcon.Error);
                // log message.
                try
                {
                    Logger.LogMessage(ex, METHOD_NAME, Level.ERROR);
                }
                catch
                {
                    PCSMessageBox.Show(ErrorCode.LOG_EXCEPTION, MessageBoxButtons.OK, MessageBoxIcon.Error);
                }
            }
        }
        /// <summary>
        /// txtShift_Validating
        /// </summary>
        /// <param name="sender"></param>
        /// <param name="e"></param>
        /// <author>Trada</author>
        /// <date>Wednesday, Nov 30 2005</date>
        private void txtShift_Validating(object sender, System.ComponentModel.CancelEventArgs e)
        {
            const string METHOD_NAME = THIS + ".txtShift_Validating()";
            try
            {
                if (txtShift.Text == string.Empty)
                {
                    txtShift.Tag = "0";
                    strLastValidShift = string.Empty;
                    return;
                }

                if (strLastValidShift == txtShift.Text.Trim()) return;

                DataRowView drwResult = null;
                drwResult = FormControlComponents.OpenSearchForm(PRO_ShiftTable.TABLE_NAME, PRO_ShiftTable.SHIFTDESC_FLD, txtShift.Text.Trim(), null, false);
                if (drwResult != null)
                {
                    txtShift.Tag = drwResult[PRO_ShiftTable.SHIFTID_FLD];
                    txtShift.Text = drwResult[PRO_ShiftTable.SHIFTDESC_FLD].ToString();
                    strLastValidShift = txtShift.Text;
                }
                else
                    e.Cancel = true;
            }
            catch (PCSException ex)
            {
                // displays the error message.
                PCSMessageBox.Show(ex.mCode, MessageBoxIcon.Error);
                // log message.
                try
                {
                    Logger.LogMessage(ex.CauseException, METHOD_NAME, Level.ERROR);
                }
                catch
                {
                    PCSMessageBox.Show(ErrorCode.LOG_EXCEPTION, MessageBoxIcon.Error);
                }
            }

            catch (Exception ex)
            {
                // displays the error message.
                PCSMessageBox.Show(ErrorCode.OTHER_ERROR, MessageBoxButtons.OK, MessageBoxIcon.Error);
                // log message.
                try
                {
                    Logger.LogMessage(ex, METHOD_NAME, Level.ERROR);
                }
                catch
                {
                    PCSMessageBox.Show(ErrorCode.LOG_EXCEPTION, MessageBoxButtons.OK, MessageBoxIcon.Error);
                }
            }
        }

        /// <summary>
        /// Make btnPrintConfiguration always enable/disable like the btnPrint
        /// </summary>
        /// <param name="sender"></param>
        /// <param name="e"></param>
        private void btnPrint_EnabledChanged(object sender, System.EventArgs e)
        {
            btnPrintConfiguration.Enabled = ((Control)sender).Enabled;
        }

        private void txtShift_KeyDown(object sender, System.Windows.Forms.KeyEventArgs e)
        {
            if (e.KeyCode == Keys.F4)
            {
                if (btnShift.Enabled)
                {
                    btnShift_Click(null, null);
                }
            }
        }

        private void btnHelp_Click(object sender, System.EventArgs e)
        {
            //ShowDelivery2OutsourcingReport(sender, e);
        }

        private void dtmPostDate_Validating(object sender, CancelEventArgs e)
        {
            const string METHOD_NAME = THIS + ".dtmPostDate_Validating()";
            try
            {
                if (dtmPostDate.Text.Trim() == string.Empty || dtmPostDate.ValueIsDbNull || mFormMode != EnumAction.Add)
                    return;
                
                //fill issue day
                FillIssueDate((DateTime)dtmPostDate.Value);
            }
            catch (Exception ex)
            {
                // error from date time control when user select date out of range
                if (ex.Message.Equals(dtmPostDate.PostValidation.ErrorMessage))
                    return;
                // displays the error message.
                PCSMessageBox.Show(ErrorCode.OTHER_ERROR, MessageBoxButtons.OK, MessageBoxIcon.Error);
                // log message.
                try
                {
                    Logger.LogMessage(ex, METHOD_NAME, Level.ERROR);
                }
                catch
                {
                    PCSMessageBox.Show(ErrorCode.LOG_EXCEPTION, MessageBoxButtons.OK, MessageBoxIcon.Error);
                }
            }
        }
        #endregion Event Processing

        private void dgrdData_Error(object sender, C1.Win.C1TrueDBGrid.ErrorEventArgs e)
        {
            e.Handled = true;
            e.Continue = true;
        }

        private void txtMasLoc_Validating(object sender, System.ComponentModel.CancelEventArgs e)
        {
            const string METHOD_NAME = THIS + ".txtMasLoc_Validating()";
            try
            {
                if (txtMasLoc.Text.Trim() == string.Empty)
                {
                    ChangeMasterLocation();
                    strLastValidMasLoc = string.Empty;
                    return;
                }
                if (strLastValidMasLoc == txtMasLoc.Text.Trim()) return;
                if (cboCCN.SelectedValue == null)
                {
                    string[] msg = { lblCCN.Text, lblMasLoc.Text };
                    PCSMessageBox.Show(ErrorCode.MESSAGE_SELECT_ONE_BEFORE_SELECT_ONE, MessageBoxIcon.Warning, msg);
                    e.Cancel = true;
                    return;
                }
                Hashtable htCondition = new Hashtable();
                htCondition.Add(MST_MasterLocationTable.CCNID_FLD, Convert.ToInt32(cboCCN.SelectedValue));
                DataRowView drvResult = FormControlComponents.OpenSearchForm(v_MasterLocationNoSecurity.TABLE_NAME, MST_MasterLocationTable.CODE_FLD, txtMasLoc.Text.Trim(), htCondition, false);
                if (drvResult != null)
                {
                    issueMaterialMaster.MasterLocationID = int.Parse(drvResult[MST_MasterLocationTable.MASTERLOCATIONID_FLD].ToString());
                    txtMasLoc.Text = drvResult[MST_MasterLocationTable.CODE_FLD].ToString();
                    txtMasLoc.Tag = drvResult[MST_MasterLocationTable.MASTERLOCATIONID_FLD];

                    // change master location
                    if (strLastValidMasLoc != txtMasLoc.Text.Trim())
                    {
                        issueMaterialMaster.ToBinID = 0;
                        issueMaterialMaster.ToLocationID = 0;

                        LoadDetailData(DateTime.MinValue, 0, 0, 0);

                        ChangeMasterLocation();

                        strLastValidMasLoc = txtMasLoc.Text.Trim();
                    }
                }
                else
                    e.Cancel = true;
            }
            catch (PCSException ex)
            {
                PCSMessageBox.Show(ex.mCode, MessageBoxIcon.Error);
                try
                {
                    Logger.LogMessage(ex.CauseException, METHOD_NAME, Level.ERROR);
                }
                catch
                {
                    PCSMessageBox.Show(ErrorCode.LOG_EXCEPTION);
                }
            }
            catch (Exception ex)
            {
                PCSMessageBox.Show(ErrorCode.OTHER_ERROR);
                try
                {
                    Logger.LogMessage(ex, METHOD_NAME, Level.ERROR);
                }
                catch
                {
                    PCSMessageBox.Show(ErrorCode.LOG_EXCEPTION);
                }
            }
        }

        private void btnDelete_Click(object sender, System.EventArgs e)
        {
            const string METHOD_NAME = THIS + ".btnDelete_Click()";
            if (txtIssueNo.Tag == null)
            {
                return;
            }

            if (PCSMessageBox.Show(ErrorCode.MESSAGE_DELETE_RECORD, MessageBoxButtons.YesNo, MessageBoxIcon.Question) == DialogResult.Yes)
            {
                try
                {
                    FormMode = EnumAction.Delete;
                    // Delete transaction
                    var boMultiWOIssueMaterialBO = new MultiWOIssueMaterialBO();
                    boMultiWOIssueMaterialBO.DeleteTransaction(Convert.ToInt32(txtIssueNo.Tag));

                    FormMode = EnumAction.Default;

                    //Turn to Add action
                    mFormMode = EnumAction.Default;

                    LockForm(true);
                    ClearForm();
                    EnableDisableButtons();
                    PCSMessageBox.Show(ErrorCode.MESSAGE_AFTER_SAVE_DATA, MessageBoxIcon.Information);
                    blnHasError = false;
                }
                catch (PCSException ex)
                {
                    if (ex.mCode == ErrorCode.MESSAGE_NOT_ENOUGH_COMPONENT_TO_COMPLETE)
                    {
                        //Show message
                        PCSMessageBox.Show(string.Format("Không đủ vật tư để xóa {0}", ex.mMethod));
                        var productId = Convert.ToInt32(ex.Hash[ITM_ProductTable.PRODUCTID_FLD]);
                        // find in the grid and set focus
                        for (int i = 0; i < dgrdData.RowCount; i++)
                        {
                            var product = Convert.ToInt32(dgrdData[i, ITM_ProductTable.PRODUCTID_FLD]);
                            if (productId == product)
                            {
                                dgrdData.Row = i;
                                dgrdData.Col = dgrdData.Columns.IndexOf(dgrdData.Columns[PRO_IssueMaterialDetailTable.AVAILABLEQUANTITY_FLD]);
                                dgrdData.Focus();
                            }
                        }
                    }
                    else
                    {
                        // displays the error message.
                        PCSMessageBox.Show(ex.mCode, MessageBoxIcon.Error);
                    }
                    // log message.
                    try
                    {
                        Logger.LogMessage(ex.CauseException, METHOD_NAME, Level.ERROR);
                    }
                    catch
                    {
                        PCSMessageBox.Show(ErrorCode.LOG_EXCEPTION, MessageBoxIcon.Error);
                    }
                }
                catch (Exception ex)
                {
                    // displays the error message.
                    PCSMessageBox.Show(ErrorCode.OTHER_ERROR, MessageBoxIcon.Error);
                    // log message.
                    try
                    {
                        Logger.LogMessage(ex, METHOD_NAME, Level.ERROR);
                    }
                    catch
                    {
                        PCSMessageBox.Show(ErrorCode.LOG_EXCEPTION, MessageBoxIcon.Error);
                    }
                }
            }
        }
    }
}